Files
Synapsis/scripts/migrate.ts
T
cyph3rasi 0ecb622565 Reconcile validated Turso runtime fix with republished main history
Hop-State: A_06FP6A2CG8PVBRDVQ5WGCN0
Hop-Proposal: R_06FP6A0YW23RY0N7Z5M8DW0
Hop-Task: T_06FP67JVF4BHPYKKC37XKQ8
Hop-Attempt: AT_06FP69RZ96ZMNF9Y5S02MT0
2026-07-14 17:23:33 -07:00

24 lines
582 B
TypeScript

import { sql } from 'drizzle-orm';
import { migrate } from 'drizzle-orm/tursodatabase/migrator';
import { closeDb, db } from '../src/db';
async function main() {
try {
const result = await migrate(db, { migrationsFolder: './drizzle' });
if (result) {
throw new Error(`Database migration failed: ${JSON.stringify(result)}`);
}
await db.run(sql.raw('PRAGMA wal_checkpoint(TRUNCATE)'));
console.log('Database migrations are up to date.');
} finally {
await closeDb();
}
}
main().catch((error) => {
console.error(error);
process.exit(1);
});