feat: add database test safety configuration

This commit is contained in:
2026-03-31 18:23:47 -07:00
parent 6cef0ac342
commit abc1963aea
7 changed files with 120 additions and 17 deletions
+12 -2
View File
@@ -10,8 +10,18 @@
const { execSync } = require('child_process');
// Database connection string
const DB_URL = 'postgresql://euchre_camp:LINGO5row_hiding@dhg.lol:5432/euchre_camp';
// Database connection string - use environment variable or default to production
const DB_URL = process.env.PROD_DATABASE_URL ||
process.env.DATABASE_URL ||
'postgresql://euchre_camp:LINGO5row_hiding@dhg.lol:5432/euchre_camp';
// Validate that we're not accidentally using dev database
if (DB_URL.includes('_dev') || DB_URL.includes('_dev_')) {
console.error('❌ ERROR: This script should not be used with the development database!');
console.error(' Current DATABASE_URL:', DB_URL);
console.error(' Please set PROD_DATABASE_URL for production database operations.');
process.exit(1);
}
// Helper to run SQL and log results
function runSQL(sql, description) {