feat: migrate from better-sqlite3 to Signal K Database API#59
Open
dirkwa wants to merge 1 commit intoxbgmsharp:mainfrom
Open
feat: migrate from better-sqlite3 to Signal K Database API#59dirkwa wants to merge 1 commit intoxbgmsharp:mainfrom
dirkwa wants to merge 1 commit intoxbgmsharp:mainfrom
Conversation
Replace direct better-sqlite3 usage with the server-managed Database API. The server now provides an isolated database per plugin — no need to ship our own SQLite binary. - Remove better-sqlite3 dependency from package.json - Use app.getDatabaseApi().getPluginDb() for async DB initialization - Convert all db.prepare().run/all() calls to db.run()/db.query() - Add async init guards for interval callbacks (db may be undefined until getPluginDb() resolves) - Migrations handled by db.migrate() instead of manual CREATE TABLE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate from shipping
better-sqlite3as a direct dependency to using the new server-managed Database API.better-sqlite3frompackage.json— no more native binary, no more rebuild issues on ARM or Node upgradesapp.getDatabaseApi().getPluginDb(plugin.id)for an isolated, server-managed SQLite databasedb.migrate()with version trackingdb.prepare().all/run()to asyncdb.query()/db.run()if (!db)sincegetPluginDb()is asyncDepends on
Tested
.db-shmand.db-walfiles present)