const { sequelize } = require('../models');

const forceRevert = async () => {
    try {
        console.log("Forcing ALL data to Jan 21, 2026...");

        // Hardcoded date string to avoid timezone issues
        const targetDate = '2026-01-21 10:00:00';

        // 1. Update Orders
        const [results, metadata] = await sequelize.query(
            `UPDATE orders SET created_at = '${targetDate}'`
        );
        console.log(`Updated Orders: ${metadata.changedRows || metadata.affectedRows}`);

        // 2. Order Items don't have created_at, skipping.
        console.log("Skipping Order items update (no created_at column).");

        console.log("Force Revert Complete.");

    } catch (error) {
        console.error("Error reverting:", error);
    } finally {
        await sequelize.close();
    }
};

forceRevert();
