17 lines
456 B
TypeScript
17 lines
456 B
TypeScript
import "dotenv/config";
|
|
import { drizzle } from "drizzle-orm/postgres-js";
|
|
import { migrate } from "drizzle-orm/postgres-js/migrator";
|
|
import postgres from "postgres";
|
|
|
|
const url =
|
|
process.env.DATABASE_URL ??
|
|
"postgres://album:album@localhost:5439/album";
|
|
|
|
const client = postgres(url, { max: 1 });
|
|
const db = drizzle(client);
|
|
|
|
await migrate(db, { migrationsFolder: "./drizzle" });
|
|
await client.end();
|
|
|
|
console.log("Migrations applied successfully.");
|