mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +00:00
d5296a4855
## 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>
21 lines
382 B
SQL
21 lines
382 B
SQL
INSERT INTO
|
|
workspace_modules (
|
|
id,
|
|
job_id,
|
|
transition,
|
|
source,
|
|
version,
|
|
key,
|
|
created_at
|
|
)
|
|
VALUES
|
|
(
|
|
'5b1a722c-b8a0-40b0-a3a0-d8078fff9f6c',
|
|
'424a58cb-61d6-4627-9907-613c396c4a38',
|
|
'start',
|
|
'test-source',
|
|
'v1.0.0',
|
|
'test-key',
|
|
'2024-11-08 10:00:00+00'
|
|
);
|