Repository navigation
fix(dev-scripts): use ncps migrate up in run.py - #1232
Conversation
bd77619 to
bb6d4d7
Compare
1ec29c3 to
1d95f60
Compare
bb6d4d7 to
7c68609
Compare
1d95f60 to
30d8101
Compare
7c68609 to
01d7799
Compare
30d8101 to
941f4c9
Compare
01d7799 to
63c059d
Compare
941f4c9 to
7257e05
Compare
63c059d to
4e7fa24
Compare
7257e05 to
8d9fae7
Compare
4e7fa24 to
574f4cf
Compare
8d9fae7 to
22cbd69
Compare
574f4cf to
77f5f1e
Compare
22cbd69 to
479faa2
Compare
77f5f1e to
0aaee14
Compare
479faa2 to
b6a213b
Compare
0aaee14 to
efb1962
Compare
|
Automated stack merge failed during the rebase step. The |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
The current branch's migrations live in migrations/<dialect>/ in goose format; run.py's `dbmate up` step was silently no-opping because dbmate's default migrations dir is db/migrations/, which no longer exists. Switch to `go run . migrate up` so the script exercises the real embedded migration runner — and, against an existing dbmate-shaped `schema_migrations` table, the dbmate→ goose adoption path in pkg/database/migrate/. For non-sqlite backends, add a `dbmate create` step before the migration. `dbmate up` used to auto-create the database; `ncps migrate up` only connects to an existing one. `dbmate create` is no-op on first failure (database already exists) and errors are suppressed, so the call is idempotent in practice. SQLite is handled by ensuring the parent directory exists; the goose runner creates the file on first connect.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev-scripts/run.py`:
- Around line 371-377: The call to subprocess.run(["dbmate", ...]) can raise
FileNotFoundError if dbmate isn't installed; add a pre-check using
shutil.which("dbmate") (like the check in perform_clean) before calling
subprocess.run in the branch that uses db_url, and if not found raise a clear
RuntimeError or print an explanatory message mentioning dbmate is missing and
instructing how to install it; keep the existing subprocess.run parameters
(check=False, stdout/stderr DEVNULL) but only execute them after the
shutil.which check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1232 +/- ##
=====================================
Coverage 5.50% 5.50%
=====================================
Files 6 6
Lines 400 400
=====================================
Hits 22 22
Misses 374 374
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The current branch's migrations live in migrations// in
goose format; run.py's
dbmate upstep was silently no-oppingbecause dbmate's default migrations dir is db/migrations/, which
no longer exists. Switch to
go run . migrate upso the scriptexercises the real embedded migration runner — and, against an
existing dbmate-shaped
schema_migrationstable, the dbmate→goose adoption path in pkg/database/migrate/.
For non-sqlite backends, add a
dbmate createstep before themigration.
dbmate upused to auto-create the database;ncps migrate uponly connects to an existing one.dbmate createis no-op on first failure (database already exists) and errors
are suppressed, so the call is idempotent in practice. SQLite is
handled by ensuring the parent directory exists; the goose runner
creates the file on first connect.