- Remove Serbian color entries from schema.sql - Add migration to delete Serbian colors from existing databases - Add migration runner scripts for easier database updates - Install pg package for PostgreSQL client support 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: DaX <noreply@anthropic.com>
37 lines
916 B
JavaScript
37 lines
916 B
JavaScript
const { Pool } = require('pg');
|
|
|
|
// Parse connection string from environment or command line
|
|
const connectionString = process.env.DATABASE_URL || process.argv[2];
|
|
const migrationSQL = process.argv[3];
|
|
|
|
if (!connectionString || !migrationSQL) {
|
|
console.error('Usage: node run-specific-migration.js "postgresql://..." "SQL"');
|
|
process.exit(1);
|
|
}
|
|
|
|
const pool = new Pool({
|
|
connectionString,
|
|
ssl: {
|
|
rejectUnauthorized: false // For AWS RDS
|
|
}
|
|
});
|
|
|
|
async function runMigration() {
|
|
try {
|
|
console.log('Running migration SQL:', migrationSQL);
|
|
|
|
// Execute the migration
|
|
const result = await pool.query(migrationSQL);
|
|
|
|
console.log('✅ Migration completed successfully!');
|
|
console.log('Rows affected:', result.rowCount);
|
|
|
|
} catch (error) {
|
|
console.error('❌ Migration failed:', error.message);
|
|
process.exit(1);
|
|
} finally {
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
runMigration(); |