const postgres = require('postgres');

const sql = postgres(process.env.DATABASE_URL || 'postgresql://jumpa_admin:JumpaS3cur3%21%40%23@xcom-ultra-alpha.ultramodul.xyz:5432/jumpadb');

async function main() {
  try {
    console.log('Adding column chat_engine_strategy to tenants table...');
    await sql`ALTER TABLE tenants ADD COLUMN IF NOT EXISTS chat_engine_strategy text NOT NULL DEFAULT 'XTM_GLOBAL_MESH'`;
    console.log('Successfully patched the database with zero downtime.');
  } catch (error) {
    console.error('Failed to patch database:', error);
  } finally {
    await sql.end();
  }
}

main();
