import {migrate} from 'postgres-schema-migrations' import path, { dirname } from 'node:path' import { fileURLToPath } from 'url'; import 'dotenv/config' const __dirname = dirname(fileURLToPath(import.meta.url)); if (!process.env.DATABASE_PASSWORD) throw new Error('DATABASE_PASSWORD is missing in env'); async function main() { const dbConfig = { database: "futureporn", user: "postgres", password: process.env.DATABASE_PASSWORD, host: 'postgresql-primary.futureporn.svc.cluster.local', port: 5432, // Default: false for backwards-compatibility // This might change! ensureDatabaseExists: true, // Default: "postgres" // Used when checking/creating "database-name" defaultDatabase: "postgres" } await migrate(dbConfig, path.join(__dirname, "./migrations/"), { schema: 'migrations_schema', logger: console.log }) } await main()