// scripts/reset-homepage-content.ts
// Deletes the homepage_content row so the editor loads fresh DEFAULT_PUCK_DATA
import { config } from 'dotenv';
config({ path: '.env.local' });
import { Pool } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-serverless';
import { homepageContent } from '../shared/schema';
import { eq } from 'drizzle-orm';

const SITE_ID = process.env.SITE_ID || 'ten-sura-game.com';

async function main() {
  const pool = new Pool({ connectionString: process.env.DATABASE_URL });
  const db = drizzle(pool);

  const result = await db
    .delete(homepageContent)
    .where(eq(homepageContent.siteId, SITE_ID));

  console.log(`Deleted homepage_content for site "${SITE_ID}". Editor will now load defaults.`);
  await pool.end();
}

main().catch(console.error);
