// fix-db: One-time migration script
process.env.DATABASE_URL = process.env.DATABASE_URL || "postgresql://jumpa_admin:JumpaS3cur3%21%40%23@127.0.0.1:5432/jumpadb";

import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import * as schema from './drizzle/schema';
import { inArray } from 'drizzle-orm';

const queryClient = postgres(process.env.DATABASE_URL);
const db = drizzle(queryClient, { schema });

async function run() {
  await db.update(schema.systemFeatures)
    .set({ module: 'JVC' })
    .where(inArray(schema.systemFeatures.key, [
      'jc.feature.supremeeye',
      'jc.feature.chronos',
      'jc.feature.vault',
      'jc.feature.multistream'
    ]));
    
  console.log('Update complete!');
  process.exit(0);
}

run().catch(console.error);
