diff --git a/.claude/commands/db-check.md b/.claude/commands/db-check.md new file mode 100644 index 0000000..ba3b05c --- /dev/null +++ b/.claude/commands/db-check.md @@ -0,0 +1,13 @@ +--- +description: Check if database connection is working and show table counts +--- + +Check if the database connection is working by: + +1. Running `pnpm --filter=@tpmjs/db db:studio` in the background to verify Prisma can connect +2. If successful, kill the studio process immediately +3. Report connection status to the user + +Then show me the current row counts for all tables (Tool, SyncCheckpoint, SyncLog) by writing a quick script that imports the Prisma client and queries each table. + +This helps verify the database is properly configured and shows if any data exists. diff --git a/.claude/commands/db-migrate.md b/.claude/commands/db-migrate.md new file mode 100644 index 0000000..d26b76e --- /dev/null +++ b/.claude/commands/db-migrate.md @@ -0,0 +1,12 @@ +--- +description: Create and apply a Prisma migration +--- + +Create and apply a new Prisma migration: + +1. Run `pnpm --filter=@tpmjs/db db:migrate` to create and apply a migration +2. The migration will be named automatically based on changes +3. After migration completes, regenerate the Prisma client with `pnpm --filter=@tpmjs/db db:generate` +4. Report the results to the user + +This is used for production-ready database schema changes that create migration files. diff --git a/.claude/commands/db-push.md b/.claude/commands/db-push.md new file mode 100644 index 0000000..329b8a4 --- /dev/null +++ b/.claude/commands/db-push.md @@ -0,0 +1,11 @@ +--- +description: Push Prisma schema changes to database (dev only) +--- + +Push the current Prisma schema to the database without creating migrations: + +1. Run `pnpm --filter=@tpmjs/db db:push` to sync schema changes to the database +2. After push completes, regenerate the Prisma client with `pnpm --filter=@tpmjs/db db:generate` +3. Report the results to the user + +This is useful for development when you want to quickly iterate on schema changes without creating migration files. Do NOT use this in production - use db:migrate instead. diff --git a/.claude/commands/db-seed.md b/.claude/commands/db-seed.md new file mode 100644 index 0000000..eddf444 --- /dev/null +++ b/.claude/commands/db-seed.md @@ -0,0 +1,11 @@ +--- +description: Seed the database with initial data +--- + +Run the database seed script to initialize the database with default data: + +1. Run `pnpm --filter=@tpmjs/db db:seed` to execute the seed script +2. The seed script will create initial SyncCheckpoint records for the changes feed and keyword sync +3. Report the results to the user + +This should be run once after creating the database to set up the initial sync checkpoints. It's safe to run multiple times - it will only create records if they don't already exist. diff --git a/.claude/commands/db-studio.md b/.claude/commands/db-studio.md new file mode 100644 index 0000000..c0d6d94 --- /dev/null +++ b/.claude/commands/db-studio.md @@ -0,0 +1,13 @@ +--- +description: Open Prisma Studio to view and edit database data +--- + +Open Prisma Studio, a visual database browser: + +1. Run `pnpm --filter=@tpmjs/db db:studio` in the background +2. Wait for the "Prisma Studio is up on http://localhost:5555" message +3. Tell the user that Prisma Studio is now running at http://localhost:5555 +4. Remind the user they can view and edit all database tables (Tool, SyncCheckpoint, SyncLog) in the browser +5. Tell them to use Ctrl+C in the terminal or kill the background process when done + +This provides a visual interface to browse, search, and edit database records.