Added support for clearing all data with data generator (#19901)

no issue

When testing Stripe migrations, it is useful to be able to clear the
database quickly without deleting admins and tokens. This is possible
with the data generator.
This commit is contained in:
Simon Backx 2024-03-25 14:44:28 +01:00 committed by GitHub
parent db62d83387
commit 89a01c2d05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,10 @@ const generateEvents = ({
startTime = new Date(),
endTime = new Date()
} = {}) => {
if (total <= 0) {
return [];
}
let alpha = 0;
let beta = 0;
let positiveTrend = trend === 'positive';

View File

@ -31,6 +31,7 @@
"knex-migrator": "yarn workspace ghost run knex-migrator",
"setup": "yarn && git submodule update --init && NODE_ENV=development node .github/scripts/setup.js",
"reset:data": "cd ghost/core && node index.js generate-data --clear-database --quantities members:100000,posts:500 --seed 123",
"reset:data:empty": "cd ghost/core && node index.js generate-data --clear-database --quantities members:0,posts:0 --seed 123",
"reset:data:xxl": "cd ghost/core && node index.js generate-data --clear-database --quantities members:2000000,posts:0,emails:0,members_stripe_customers:0,members_login_events:0,members_status_events:0 --seed 123",
"docker:reset": "docker-compose -f .github/scripts/docker-compose.yml down -v && docker-compose -f .github/scripts/docker-compose.yml up -d --wait",
"lint": "nx run-many -t lint",