uat-seed-script
This commit is contained in:
25
scripts/seed-reset.ts
Normal file
25
scripts/seed-reset.ts
Normal 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();
|
||||
Reference in New Issue
Block a user