Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
629 B
TypeScript
22 lines
629 B
TypeScript
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import dotenv from 'dotenv';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
dotenv.config({ path: path.resolve(__dirname, '../../../.env') });
|
|
|
|
import { migrate } from 'drizzle-orm/node-postgres/migrator';
|
|
import { getDb, getPool } from './index';
|
|
|
|
async function main() {
|
|
console.log('Running migrations...');
|
|
await migrate(getDb(), { migrationsFolder: path.resolve(__dirname, '../migrations') });
|
|
console.log('Migrations complete.');
|
|
await getPool().end();
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|