Skip to content

Show which database db:migrate targets and ask before applying - #66

Merged
maaland merged 1 commit into
mainfrom
fix/migrate-target-65
Oct 12, 2026
Merged

maaland merged 1 commit into
mainfrom
fix/migrate-target-65

Conversation

@maaland

@maaland maaland commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Closes #65

Covers all three "Done when" lines of #65.

What changes

pnpm db:migrate now:

Database: aws-0-eu-central-1.pooler.supabase.com:6543/postgres as postgres.<ref> (Supabase project <ref>)
Pending: 0004_something.sql
Apply these to this database? [y/N]
  • Shows the target first: host, database, user, and the Supabase project ref for pooler users. Never the password.
  • Lists the pending migrations, or says it's already up to date.
  • Asks in a terminal. --yes applies without asking. Without a terminal and without --yes, nothing is applied.
  • pnpm db:migrate --status shows the target and the pending list, and changes nothing.
  • pendingMigrations(sql) is split out of migrate(), and the behaviour is unchanged.

Checked

  • New test: pending migrations are listed without being applied, and come back empty after migrate().
  • Ran the script against a blank local PGlite with a fake Supabase-style user: --status, no terminal (refuses), a terminal answered "n" (not applied), --yes (applies all three), then "already up to date". The password never appears.
  • pnpm lint, pnpm typecheck, pnpm test pass.

🤖 Generated with Claude Code

pnpm db:migrate now prints the target (host, database and user, the
Supabase project ref when there is one, never the password) and the
migrations it would apply, then asks. --yes applies without asking;
--status only shows. Without a terminal and without --yes, nothing is
applied.

Closes #65

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@drippa-ai

drippa-ai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Drippa Sign-Off: Show the target database and pending migrations, and confirm before db:migrate applies them

✅ Delivers ticket #65 — 4 of 5 outcomes

Open in Drippa

What was promised

  • ✅ Running the command shows the target database (host, database, user, Supabase project) without the password before doing anything.
  • ✅ It lists the migrations it would apply, or says the database is already up to date.
  • ✅ It waits for "y" in a terminal, applies without asking when given --yes, and applies nothing without a terminal and without --yes.
  • ⚠️ The status option shows the target and pending list and applies no migrations. On a fresh database it still creates the empty table that tracks migrations.
  • ✅ Listing pending migrations is covered by an automated test.

Proof
Not tested in the browser: behaviour change with no page to click.

Steps based on ticket #65, the pull request description and the code change.

Details

Before it changes anything, the database migration command prints the host, database and user it will touch, plus the Supabase project for Supabase pooler users, and never the password. It then lists the pending migrations or says the database is up to date. It asks for "y" in a terminal, skips the question with --yes, and refuses to apply without a terminal. A status flag shows the same information and stops. On a brand-new database, the status check still creates the empty table that tracks applied migrations.

Test coverage: ⚠️ Thin — One new test checks the pending list before and after applying migrations. The prompt, the flags and the target line have no automated tests.

🔍 Checked: ticket #65 with 3 done-when lines and 4 build items; 3 of 3 changed files read

🎫 Compared against drippa-ai/stackprobe#65


Updated by Drippa • 2026-10-12 19:19 UTC

Comment @drippa-ai review for a fresh review.

@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stackprobe Ready Ready Preview Oct 12, 2026 7:24pm UTC

Request Review

@maaland
maaland merged commit 385a445 into main Oct 12, 2026
7 checks passed
@maaland
maaland deleted the fix/migrate-target-65 branch October 12, 2026 19:28

This branch was successfully deployed

1 active deployment
Preview — 527c97f0 Deployed Oct 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

db:migrate: show which database it targets and ask before applying

1 participant