change to better sqlite3
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { watchFile } from "node:fs";
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import Database from "better-sqlite3";
|
||||
|
||||
export type StepRow = {
|
||||
date: string;
|
||||
@@ -7,7 +7,7 @@ export type StepRow = {
|
||||
};
|
||||
|
||||
export class GadgetbridgeClient {
|
||||
private db: DatabaseSync;
|
||||
private db: Database.Database;
|
||||
private readonly dbPath: string;
|
||||
private readonly oldDbPath: string;
|
||||
|
||||
@@ -23,8 +23,8 @@ export class GadgetbridgeClient {
|
||||
});
|
||||
}
|
||||
|
||||
private openDb(): DatabaseSync {
|
||||
const db = new DatabaseSync(this.dbPath, { open: true });
|
||||
private openDb(): Database.Database {
|
||||
const db = new Database(this.dbPath, { readonly: true });
|
||||
db.exec(`ATTACH DATABASE '${this.oldDbPath}' AS old`);
|
||||
return db;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user