Skip to content

Read-only migration status queries (skip CREATE TABLE)#3144

Merged
tyt2y3 merged 3 commits into
masterfrom
migration-read-only-status
Jul 23, 2026
Merged

Read-only migration status queries (skip CREATE TABLE)#3144
tyt2y3 merged 3 commits into
masterfrom
migration-read-only-status

Conversation

@tyt2y3

@tyt2y3 tyt2y3 commented Jul 23, 2026

Copy link
Copy Markdown
Member

Adds get_pending_migrations_read_only / get_applied_migrations_read_only / get_migration_with_status_read_only (on both migrator traits) that query migration status without running CREATE TABLE, so a DB user without DDL privileges can check for pending migrations. A missing migration table reports all as pending. Purely additive.

Closes #3141

tyt2y3 added 3 commits July 23, 2026 17:52
Add `get_pending_migrations_read_only`, `get_applied_migrations_read_only`,
and `get_migration_with_status_read_only` to both `MigratorTrait` and
`MigratorTraitSelf`. They mirror the existing query methods but never run
`CREATE TABLE`, so a database user without DDL privileges can check migration
status. A missing migration table reports all migrations as pending.

Purely additive; existing methods are unchanged.

Closes #3141
The test connects to sqlite::memory:, but the MySQL/Postgres CI jobs run the
migrator tests with only their own backend feature (no sqlite driver), so the
test failed there. Gate the whole file on the sqlx-sqlite feature.
Replace the sqlite-only read_only test with a run_read_only_test in the
migrator integration suite, which runs against SQLite, MySQL, and Postgres via
DATABASE_URL. Verifies status queries report pending without creating the
table, work once it exists, and reflect applied migrations.
@tyt2y3
tyt2y3 merged commit 92cf399 into master Jul 23, 2026
39 checks passed
@tyt2y3
tyt2y3 deleted the migration-read-only-status branch July 23, 2026 20:28
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.

1 participant