<?php
declare(strict_types=1);

/**
 * One-off: remove all promo codes (and redemptions via CASCADE) from data/users.sqlite.
 * Usage: php scripts/purge-promo-codes.php
 */

require_once dirname(__DIR__) . '/api/db.php';

$pdo = mocker_db();
$before = (int) $pdo->query('SELECT COUNT(*) FROM promo_codes')->fetchColumn();
$pdo->exec('DELETE FROM promo_codes');
$after = (int) $pdo->query('SELECT COUNT(*) FROM promo_codes')->fetchColumn();
echo "Removed {$before} promo code(s). Remaining: {$after}.\n";
