From c8e64374c4178bd0c1f3bb36222cc3b8d0314aa2 Mon Sep 17 00:00:00 2001 From: christianmat Date: Sun, 21 Jan 2024 22:11:30 -0800 Subject: [PATCH] fix(sqlite): move table and index creation to single call --- .../src/services/data/sqlite/sqlite.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/remote-storage-server/src/services/data/sqlite/sqlite.service.ts b/apps/remote-storage-server/src/services/data/sqlite/sqlite.service.ts index a92ff18..04708a9 100644 --- a/apps/remote-storage-server/src/services/data/sqlite/sqlite.service.ts +++ b/apps/remote-storage-server/src/services/data/sqlite/sqlite.service.ts @@ -10,8 +10,9 @@ export class SqliteService implements OnModuleInit, DataService { async onModuleInit() { try { this.db = new this.sqlite3.Database('./database.sqlite') - await this.db.run('CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT)') - await this.db.run('CREATE INDEX IF NOT EXISTS key_index ON kv (key)') + await this.db.run( + 'CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT); CREATE INDEX IF NOT EXISTS key_index ON kv (key)' + ) } catch (e) { console.error('Failed to initialize sqlite database', e) }