feat: add reliable local database reset
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-08 23:13:33 -04:00
parent cf6291041d
commit 3c8a1d1154
2 changed files with 18 additions and 0 deletions
+15
View File
@@ -83,6 +83,21 @@ This command starts healthy PostgreSQL and Redis containers, applies migrations,
The command does not provision an administrator automatically. Run `npm run provision:admin` once after setting the initial administrator variables in `.env` when admin access is needed. Stop the application processes with `Ctrl+C`; stop the containers separately with `npm run db:down` when they are no longer needed. The command does not provision an administrator automatically. Run `npm run provision:admin` once after setting the initial administrator variables in `.env` when admin access is needed. Stop the application processes with `Ctrl+C`; stop the containers separately with `npm run db:down` when they are no longer needed.
For a disposable local database reset, use:
```sh
npm run db:reset
npm run provision:admin
```
Or combine both operations with:
```sh
npm run db:reset:admin
```
`db:reset` removes the local PostgreSQL and Redis volumes, recreates healthy containers, and synchronizes the current Drizzle schema with `drizzle-kit push --force`. It is destructive and local-development-only. It does not modify `.env`.
## Visual Development ## Visual Development
Run Storybook to inspect the authoritative design tokens and mock visual fixtures without requiring API data: Run Storybook to inspect the authoritative design tokens and mock visual fixtures without requiring API data:
+3
View File
@@ -11,6 +11,9 @@
"db:generate": "drizzle-kit generate", "db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate", "db:migrate": "drizzle-kit migrate",
"db:up": "docker compose up -d --wait postgres redis", "db:up": "docker compose up -d --wait postgres redis",
"db:sync:local": "drizzle-kit push --force",
"db:reset": "docker compose down -v && npm run db:up && npm run db:sync:local",
"db:reset:admin": "npm run db:reset && npm run provision:admin",
"dev": "npm run dev:prepare && concurrently --kill-others --names api,web,worker --prefix-colors blue,green,yellow \"npm run dev:api\" \"npm run dev:web\" \"npm run dev:worker\"", "dev": "npm run dev:prepare && concurrently --kill-others --names api,web,worker --prefix-colors blue,green,yellow \"npm run dev:api\" \"npm run dev:web\" \"npm run dev:worker\"",
"dev:api": "npm run start --workspace=@pokemon-inventory/api", "dev:api": "npm run start --workspace=@pokemon-inventory/api",
"dev:prepare": "npm run db:up && npm run db:migrate", "dev:prepare": "npm run db:up && npm run db:migrate",