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
This commit is contained in:
+12
-6
@@ -1,14 +1,20 @@
|
||||
import { sql } from 'drizzle-orm';
|
||||
import { migrate } from 'drizzle-orm/tursodatabase/migrator';
|
||||
import { db } from '../src/db';
|
||||
import { closeDb, db } from '../src/db';
|
||||
|
||||
async function main() {
|
||||
const result = await migrate(db, { migrationsFolder: './drizzle' });
|
||||
try {
|
||||
const result = await migrate(db, { migrationsFolder: './drizzle' });
|
||||
|
||||
if (result) {
|
||||
throw new Error(`Database migration failed: ${JSON.stringify(result)}`);
|
||||
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();
|
||||
}
|
||||
|
||||
console.log('Database migrations are up to date.');
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user