Portfolio/Websites/jefes-nextjs/db/migrate.ts
2023-12-07 22:38:51 -08:00

9 lines
386 B
TypeScript

import 'dotenv/config';
import { migrate } from 'drizzle-orm/mysql2/migrator';
import { db, connection } from './db';
// This will run migrations on the database, skipping the ones already applied
const push = await migrate(db, { migrationsFolder: './drizzle/migrations' });
// Don't forget to close the connection, otherwise the script will hang
const con = await connection.end();