0ecb622565
Hop-State: A_06FP6A2CG8PVBRDVQ5WGCN0 Hop-Proposal: R_06FP6A0YW23RY0N7Z5M8DW0 Hop-Task: T_06FP67JVF4BHPYKKC37XKQ8 Hop-Attempt: AT_06FP69RZ96ZMNF9Y5S02MT0
24 lines
582 B
TypeScript
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);
|
|
});
|