fix: backport migration fixes#21611
Merged
johnstcn merged 3 commits intorelease/2.29from Jan 21, 2026
Merged
Conversation
## Problem Migration 000401 introduced a hardcoded `public.` schema qualifier which broke deployments using non-public schemas (see #21493). We need to prevent this from happening again. ## Solution Adds a new `lint/migrations` Make target that validates database migrations do not hardcode the `public` schema qualifier. Migrations should rely on `search_path` instead to support deployments using non-public schemas. ## Changes - Added `scripts/check_migrations_schema.sh` - a linter script that checks for `public.` references in migration files (excluding test fixtures) - Added `lint/migrations` target to the Makefile - Added `lint/migrations` to the main `lint` target so it runs in CI ## Testing - Verified the linter **fails** on current `main` (which has the hardcoded `public.` in migration 000401) - Verified the linter **passes** after applying the fix from #21493 ```bash # On main (fails) $ make lint/migrations ERROR: Migrations must not hardcode the 'public' schema. Use unqualified table names instead. # After fix (passes) $ make lint/migrations Migration schema references OK ``` ## Depends on - #21493 must be merged first (or this PR will fail CI until it is) --------- Signed-off-by: Danny Kopping <danny@coder.com> Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com> Co-authored-by: Danny Kopping <danny@coder.com> (cherry picked from commit d5296a4)
…21530) Fixes shellcheck warning reported in #21496 (comment) ## Problem The `error()` function in `lib.sh` already calls `exit 1`, so the `exit 1` on line 17 of `check_pg_schema.sh` was unreachable: ``` In ./scripts/check_pg_schema.sh line 17: exit 1 ^----^ SC2317 (info): Command appears to be unreachable. ``` ## Solution Remove the redundant `exit 1` since `error()` already handles exiting. Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com> (cherry picked from commit 3b07f7b)
df63aa2 to
e8c482a
Compare
dannykopping
approved these changes
Jan 21, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
NB these commits were originally authored by Blink on behalf of @dannykopping, so amended to reflect actual authorship.
Repro/Verification Steps:
Created a Coder deployment with a non-public schema via Docker compose on v2.28.6:
db-init/01-create-schema.sqlwith the following:postgrescontainer:volumes: - coder_data:/var/lib/postgresql/data + - ./db-init:/docker-entrypoint-initdb.d:roCODER_PG_CONNECTION_URLto update the search path:CODER_VERSION=v2.28.6 CODER_ACCESS_URL=http://localhost:7080 POSTGRES_USER=coder POSTGRES_PASSWORD=coder docker compose up`Updated to
v2.29.1:CODER_VERSION=v2.29.1 CODER_ACCESS_URL=http://localhost:7080 POSTGRES_USER=coder POSTGRES_PASSWORD=coder docker compose up`Observed following error:
Built image locally:
Started with new image:
Observed migrations ran successfully and Coder came up successfully