import { Database, Migrator } from '../../db' import migrations from './migrations' import { DidCacheSchema } from './schema' export * from './schema' export type DidCacheDb = Database export const getDb = ( location: string, disableWalAutoCheckpoint = false, ): DidCacheDb => { const pragmas: Record = disableWalAutoCheckpoint ? { wal_autocheckpoint: '0', synchronous: 'NORMAL' } : { synchronous: 'NORMAL' } return Database.sqlite(location, { pragmas }) } export const getMigrator = (db: DidCacheDb) => { return new Migrator(db.db, migrations) }