Repository navigation
feat: add rowx database command - #161
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d27125d15f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #146
What
Adds
rowx database create | drop [--force] [-y] | reset [--force] [-y] | setupinsrc/rowx/check/database.py, built on the admin bindings (rowx.postgres._admin) and themigrate runlogic.createcreates the database named in the URL; if it exists it says so and exits 0.dropconfirms on a TTY (y/yes); without a TTY it needs-y, else exits 2 and drops nothing.--forceisWITH (FORCE).resetis drop, create, thenmigrate run.setupis create-if-missing, thenmigrate run.--database-urland--configon all;--sourceonresetandsetup. Exit 0 or 2, errors redacted as inmigrate. Only the database name is printed, never the URL or password.migrate.pyis refactored lightly sodatabasereuses it:resolve_target,require_url,run_guarded(shared error mapping and redaction),load_migratorandrun_pending(themigrate runcall).migratebehaviour is unchanged.resetandsetupread and validate the migration files before confirming or touching the database, so a brokenmigrations/never leaves a dropped or half-set-up database.New tests (named)
Unit,
src/rowx/__tests__/unit/check/test_database.py:test_parses_flags,test_rejects_flags_that_do_not_apply,test_requires_a_subcommand,test_yes_skips_the_prompt,test_no_tty_without_yes_is_an_error,test_tty_prompt,test_no_database_url_exits_two,test_unreachable_database_exits_two_without_the_password,test_url_without_a_database_name_exits_two.DB,
src/rowx/__tests__/integration/check/test_database.py(uniquely namedrowx_dbcli_<hex>databases, always dropped):test_create_twice_exits_zero,test_drop_with_yes,test_drop_without_tty_or_yes_exits_two_and_keeps_the_database,test_drop_confirms_on_a_tty,test_force_drops_a_database_with_a_live_session,test_setup_creates_and_migrates_then_is_idempotent,test_reset_recreates_the_database_with_every_migration_applied,test_reset_without_tty_or_yes_exits_two,test_a_password_is_never_printed,test_invalid_migrations_fail_before_any_database_change.Wiring edits
src/rowx/check/cli.py: registers thedatabaseparser and dispatches it (_migratewrapper becomes the generic_subcommand).src/rowx/check/migrate.py: the shared helpers above.src/rowx/__tests__/integration/check/test_migrate_cli.py(from feat: add rowx migrate command #160) totest_migrate.py, so integration test files follow AGENTS.md'stest_<module>.pyrule. No other file references it; the golden files are unchanged.Spec ambiguities
checker.mdsayscreate"is an error if it exists", while feat: add rowx database command #146 says it reports that and exits 0. I followed feat: add rowx database command #146 (as sqlx-cli does); the design text should be aligned.Abortedand exits 0 (sqlx-cli behaviour); the design only specifies 0 or 2 for failures.dropof a missing database is a no-op success (the admin binding's contract).resetconfirms once, up front, before dropping.test_database_cli.py; it istest_database.pyhere per AGENTS.md.schemafixture, since the command under test creates and drops the database itself (testing.md allows "a fresh schema or database" for migration tests).🤖 Generated with Claude Code