import migrationService from '../services/migrationService'; import type { QueryExecResult } from '../services/migrationService'; const MIGRATIONS = [ { name: '001_create_accounts_table', // see ../db/tables files for explanations sql: ` CREATE TABLE IF NOT EXISTS accounts ( id INTEGER PRIMARY KEY AUTOINCREMENT, dateCreated TEXT NOT NULL, derivationPath TEXT, did TEXT NOT NULL, identity TEXT, mnemonic TEXT, passkeyCredIdHex TEXT, publicKeyHex TEXT NOT NULL ); CREATE INDEX IF NOT EXISTS idx_accounts_did ON accounts(did); CREATE INDEX IF NOT EXISTS idx_accounts_publicKeyHex ON accounts(publicKeyHex); ` } ]; export async function registerMigrations(): Promise { // Register all migrations for (const migration of MIGRATIONS) { await migrationService.registerMigration(migration); } } export async function runMigrations( sqlExec: (sql: string, params?: any[]) => Promise> ): Promise { await registerMigrations(); await migrationService.runMigrations(sqlExec); }