Add script to clear key value cache

This commit is contained in:
Max Isom 2022-01-07 13:47:53 -06:00
parent 892c06a110
commit c3231defb8
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880
2 changed files with 11 additions and 0 deletions

View file

@ -25,6 +25,7 @@
"build:watch": "tsc --watch", "build:watch": "tsc --watch",
"prepack": "npm run clean && npm run build", "prepack": "npm run clean && npm run build",
"start": "npm run env:set-database-url -- node --experimental-json-modules dist/src/scripts/migrate-and-start.js", "start": "npm run env:set-database-url -- node --experimental-json-modules dist/src/scripts/migrate-and-start.js",
"cache:clear-key-value": "npm run env:set-database-url node dist/src/scripts/cache-clear-key-value.js",
"dev": "concurrently nodemon 'tsc --watch'", "dev": "concurrently nodemon 'tsc --watch'",
"migrations:generate": "npm run prisma:with-env migrate dev", "migrations:generate": "npm run prisma:with-env migrate dev",
"migrations:run": "npm run prisma:with-env migrate deploy", "migrations:run": "npm run prisma:with-env migrate deploy",

View file

@ -0,0 +1,10 @@
import ora from 'ora';
import {prisma} from '../utils/db.js';
(async () => {
const spinner = ora('Clearing key value cache...').start();
await prisma.keyValueCache.deleteMany({});
spinner.succeed('Key value cache cleared.');
})();