Repository navigation
feat(releases): validate the foreign keys into sentry_release - #127327
Merged
Merged
Conversation
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_deploy'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_deploy', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_distribution'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_distribution', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_groupresolution'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_groupresolution', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_release_project'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_release_project', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_releaseactivity'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_releaseactivity', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_releasecommit'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_releasecommit', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_releaseheadcommit'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_releaseheadcommit', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_releaseprojectenvironment'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_releaseprojectenvironment', fk_name);
END LOOP;
END $$;
--
-- Raw SQL operation
--
DO $$
DECLARE
fk_name text;
BEGIN
FOR fk_name IN
SELECT conname
FROM pg_constraint
WHERE contype = 'f'
AND conrelid = 'sentry_groupedmessage'::regclass
AND confrelid = 'sentry_release'::regclass
AND NOT convalidated
LOOP
EXECUTE format('ALTER TABLE %I VALIDATE CONSTRAINT %I', 'sentry_groupedmessage', fk_name);
END LOOP;
END $$; |
ldelvoye
commented
Oct 13, 2026
ldelvoye
left a comment
Member
Author
There was a problem hiding this comment.
🌱 Looked through this, no blocking issues.
CI had failures when I looked; this is a verdict on the code.
This review was generated by a bot; every message tagged 🌱 is from it. Reply with bot: to ask it something.
markstory
approved these changes
Oct 14, 2026
This was referenced Oct 15, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
resolves INFRENG-726
Adds a post-deployment migration that validates the foreign keys into
sentry_release, which the 1207 primary key swap re-added asNOT VALID.@markstory this is the follow-up you asked for on #126200. Each table is validated in its own transaction with no statement timeout, and
sentry_groupedmessagegoes last. Validation only takes SHARE UPDATE EXCLUSIVE on the child table and ROW SHARE onsentry_release, so reads and writes keep flowing. A rerun after an interrupted run skips the keys that are already validated, so it's safe to cancel and restart.