From 3c8a1d1154a87a09f25027f7a8c000250bbe9013 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Tue, 8 Sep 2026 23:13:33 -0400 Subject: [PATCH] feat: add reliable local database reset --- README.md | 15 +++++++++++++++ package.json | 3 +++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index f682e93..0fbc0a2 100644 --- a/README.md +++ b/README.md @@ -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. +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 Run Storybook to inspect the authoritative design tokens and mock visual fixtures without requiring API data: diff --git a/package.json b/package.json index f6b6af0..5bfadb2 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,9 @@ "db:generate": "drizzle-kit generate", "db:migrate": "drizzle-kit migrate", "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:api": "npm run start --workspace=@pokemon-inventory/api", "dev:prepare": "npm run db:up && npm run db:migrate",