uat-seed-script

This commit is contained in:
phaichayon
2026-06-30 10:48:15 +07:00
parent e4573ac0c9
commit e12ae120b0
31 changed files with 1791 additions and 314 deletions

25
scripts/seed-reset.ts Normal file
View File

@@ -0,0 +1,25 @@
import { runCommand, runNodeScript } from './lib/seed-utils.ts';
const ALLOW_DB_RESET_FLAG = '--allow-db-reset';
function main() {
const allowDbReset =
process.env.ALLOW_DB_RESET === 'true' ||
process.argv.includes(ALLOW_DB_RESET_FLAG);
if (!allowDbReset) {
throw new Error(
`seed:reset requires explicit confirmation. Run "npm run seed:reset -- ${ALLOW_DB_RESET_FLAG}".`
);
}
// Normalize the guard so downstream reset scripts keep the same safety contract.
process.env.ALLOW_DB_RESET = 'true';
runNodeScript('seed:reset:db-reset', 'scripts/db/reset-database.ts');
runCommand('seed:reset:db-migrate', 'npx', ['drizzle-kit', 'migrate']);
runNodeScript('seed:reset:seed-system', 'scripts/seed-system.ts');
runNodeScript('seed:reset:seed-uat', 'scripts/seed-uat.ts');
}
main();