fixing migrate
All checks were successful
Recommender Build and Deploy (internal) / Build Recommender Image (push) Successful in 4m4s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Successful in 11s

This commit is contained in:
2026-03-26 22:03:45 -03:00
parent c730a53dd0
commit deb3a89f56

View File

@@ -2,6 +2,11 @@ import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';
import * as dotenv from 'dotenv';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
dotenv.config({ path: ['.env.local', '.env'] });
@@ -19,7 +24,8 @@ const db = drizzle(migrationClient);
const runMigrations = async () => {
console.log('Running database migrations...');
try {
await migrate(db, { migrationsFolder: './drizzle' });
const folder = path.join(__dirname, '../drizzle');
await migrate(db, { migrationsFolder: folder });
console.log('Migrations completed successfully.');
} catch (err) {
console.error('Error running migrations:', err);