mirror of
https://github.com/fergalmoran/opengifame.git
synced 2025-12-26 03:27:34 +00:00
Fix deployment issues: URL-encode database password, add auto-migrations, fix dynamic server error
This commit is contained in:
28
scripts/migrate.js
Normal file
28
scripts/migrate.js
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
async function runMigrations() {
|
||||
try {
|
||||
console.log('🔄 Running database migrations...');
|
||||
|
||||
// Check if we have a DATABASE_URL
|
||||
if (!process.env.DATABASE_URL) {
|
||||
console.log('⚠️ No DATABASE_URL found, skipping migrations');
|
||||
return;
|
||||
}
|
||||
|
||||
// Run migrations
|
||||
execSync('npx drizzle-kit migrate', {
|
||||
stdio: 'inherit',
|
||||
env: process.env
|
||||
});
|
||||
|
||||
console.log('✅ Database migrations completed successfully!');
|
||||
} catch (error) {
|
||||
console.error('❌ Migration failed:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
runMigrations();
|
||||
Reference in New Issue
Block a user