Skip to content

fix(postgres): the migration check reads the tracker of the configured schema only - #2257

Merged
c-thiel merged 1 commit into
mainfrom
ct/schema-tracker-check
Nov 6, 2026
Merged

c-thiel merged 1 commit into
mainfrom
ct/schema-tracker-check

Conversation

@c-thiel

@c-thiel c-thiel commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

With LAKEKEEPER__PG_SCHEMA set, the start-up migration check of serve and wait-for-db -dm now reads the migration tracker of that schema only. Connections use search_path = <schema>, public, so for a schema without a tracker the check could read the tracker of an installation in public and report the database as migrated. It now reports the schema as not migrated, and wait-for-db waits for migrate.

  • migrate already creates the tracker in the configured schema and is unchanged.
  • Deployments without LAKEKEEPER__PG_SCHEMA are unchanged.
  • Test: an empty mixed-case schema next to an installation in public is not migrated, and is migrated after migrate.

Release notes

Bug Fixes

  • The migration check reads the configured schema. With LAKEKEEPER__PG_SCHEMA set, serve and wait-for-db check the migrations of that schema only, also when public holds another installation.

Summary by CodeRabbit

  • Bug Fixes
    • Migration status now correctly reports when the configured schema has no migration records, even if records exist in another schema.
    • After migrations create the records in the configured schema, status correctly reports that migrations are complete. This makes migration status more reliable when working with schemas that differ from the default.

…d schema only

With `LAKEKEEPER__PG_SCHEMA` set, the search_path is `<schema>, public`. If the configured schema exists but holds no `_sqlx_migrations`, the unqualified tracker name resolved to `public._sqlx_migrations`, so a second install in `public` made the check report `Complete` and `serve` / `wait-for-db -dm` start against `public`'s tables. The check now reports `NoMigrationsTable` when the configured schema has no tracker of its own.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The migration status check now verifies that the configured current schema has its own core migration tracker. A regression test checks the result when only public has a tracker, then checks the status after migration creates the tracker in the configured schema.

Changes

Migration status check

Layer / File(s) Summary
Schema-local tracker check
crates/lakekeeper-storage-postgres/src/migrations/mod.rs
A schema-qualified lookup checks for the core migration tracker. If the configured schema is current but has no local tracker, status returns NoMigrationsTable, even when public has a tracker. The documentation and regression test cover this behavior and the status after migration.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: vyruss

Merge Risk: Minimal · up to 9dcec

The schema-local migration check has no identified issue blocking merge after normal checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the migration check change for the configured schema.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the schema’s name,
And finds its tracker, not the same.
If none is there, the status knows,
Then migration plants it as it goes.
The rabbit hops through checks complete.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 047d0c6d-9b93-47e7-9c2a-29a1da609e02
Commits

Reviewing files that changed from the base of the PR and between b4660f6 and 9dcec49.

Files selected for processing: 1

  • crates/lakekeeper-storage-postgres/src/migrations/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@c-thiel
c-thiel merged commit 3c32455 into main Nov 6, 2026
8 of 27 checks passed
@c-thiel
c-thiel deleted the ct/schema-tracker-check branch November 6, 2026 09:13
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