Skip to content

linter: add cross-file validation for NOT NULL constraint pattern#957

Merged
kodiakhq[bot] merged 4 commits intosbdchd:masterfrom
reteps:cross-file-validation
Mar 9, 2026
Merged

linter: add cross-file validation for NOT NULL constraint pattern#957
kodiakhq[bot] merged 4 commits intosbdchd:masterfrom
reteps:cross-file-validation

Conversation

@reteps
Copy link
Contributor

@reteps reteps commented Feb 24, 2026

Generally, I want to be able to track the NOT NULL constraints across migration files as our postgres deployments have a transaction-per-file, and so I do the constraint in a different, earlier migration than the SET NOT NULL change.

-- migration 1
ALTER TABLE foo ADD CONSTRAINT foo_bar_not_null CHECK (bar IS NOT NULL) NOT VALID;
-- migration 2
ALTER TABLE foo VALIDATE CONSTRAINT foo_bar_not_null;

ALTER TABLE foo
  ALTER COLUMN bar SET NOT NULL;

ALTER TABLE foo
  DROP CONSTRAINT foo_bar_not_null;

Follow up to #910

@netlify
Copy link

netlify bot commented Feb 24, 2026

👷 Deploy request for squawkhq pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 3bbd0fa

@reteps reteps changed the title Add cross-file validation for NOT NULL constraint pattern linter: add cross-file validation for NOT NULL constraint pattern Feb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sbdchd
Copy link
Owner

sbdchd commented Mar 9, 2026

Sorry for the delay, looks good, thank you!

@sbdchd sbdchd added the automerge automerge with kodiak label Mar 9, 2026
@kodiakhq kodiakhq bot merged commit 6b0821e into sbdchd:master Mar 9, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge automerge with kodiak

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants