feat(seer): migration for SeerProjectRepository and SeerProjectRepositoryBranchOverride models#110542
Merged
feat(seer): migration for SeerProjectRepository and SeerProjectRepositoryBranchOverride models#110542
Conversation
Add a join table linking Project to Repository with per-repo Seer configuration (branch_name, instructions, branch_overrides). This is Phase 1 of migrating Seer project preferences into the Sentry DB. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Backend Test FailuresFailures on
|
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Create model SeerProjectRepository
--
CREATE TABLE "seer_projectrepository" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "date_updated" timestamp with time zone NOT NULL, "date_added" timestamp with time zone NOT NULL, "branch_name" text NULL, "instructions" text NULL, "project_id" bigint NOT NULL, "repository_id" bigint NOT NULL);
--
-- Create model SeerProjectRepositoryBranchOverride
--
CREATE TABLE "seer_projectrepositorybranchoverride" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "date_updated" timestamp with time zone NOT NULL, "date_added" timestamp with time zone NOT NULL, "tag_name" text NOT NULL, "tag_value" text NOT NULL, "branch_name" text NOT NULL, "seer_project_repository_id" bigint NOT NULL);
CREATE UNIQUE INDEX CONCURRENTLY "seer_projectrepository_project_id_repository_id_f08c56d6_uniq" ON "seer_projectrepository" ("project_id", "repository_id");
ALTER TABLE "seer_projectrepository" ADD CONSTRAINT "seer_projectrepository_project_id_repository_id_f08c56d6_uniq" UNIQUE USING INDEX "seer_projectrepository_project_id_repository_id_f08c56d6_uniq";
ALTER TABLE "seer_projectrepository" ADD CONSTRAINT "seer_projectrepository_project_id_9b6ca557_fk_sentry_project_id" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "seer_projectrepository" VALIDATE CONSTRAINT "seer_projectrepository_project_id_9b6ca557_fk_sentry_project_id";
ALTER TABLE "seer_projectrepository" ADD CONSTRAINT "seer_projectreposito_repository_id_1c1c52ec_fk_sentry_re" FOREIGN KEY ("repository_id") REFERENCES "sentry_repository" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "seer_projectrepository" VALIDATE CONSTRAINT "seer_projectreposito_repository_id_1c1c52ec_fk_sentry_re";
CREATE INDEX CONCURRENTLY "seer_projectrepository_project_id_9b6ca557" ON "seer_projectrepository" ("project_id");
CREATE INDEX CONCURRENTLY "seer_projectrepository_repository_id_1c1c52ec" ON "seer_projectrepository" ("repository_id");
CREATE UNIQUE INDEX CONCURRENTLY "seer_projectrepositorybr_seer_project_repository__e53d101f_uniq" ON "seer_projectrepositorybranchoverride" ("seer_project_repository_id", "tag_name", "tag_value");
ALTER TABLE "seer_projectrepositorybranchoverride" ADD CONSTRAINT "seer_projectrepositorybr_seer_project_repository__e53d101f_uniq" UNIQUE USING INDEX "seer_projectrepositorybr_seer_project_repository__e53d101f_uniq";
ALTER TABLE "seer_projectrepositorybranchoverride" ADD CONSTRAINT "seer_projectreposito_seer_project_reposit_b6516aa2_fk_seer_proj" FOREIGN KEY ("seer_project_repository_id") REFERENCES "seer_projectrepository" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "seer_projectrepositorybranchoverride" VALIDATE CONSTRAINT "seer_projectreposito_seer_project_reposit_b6516aa2_fk_seer_proj";
CREATE INDEX CONCURRENTLY "seer_projectrepositorybran_seer_project_repository_id_b6516aa2" ON "seer_projectrepositorybranchoverride" ("seer_project_repository_id"); |
Add comparator and test data for SeerProjectRepository so backup scoping tests include the new model in export/import verification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Backend Test FailuresFailures on
|
Repository has RelocationScope.Global, so SeerProjectRepository must also be Global-scoped. Otherwise, during Organization-scoped exports, Repository PKs aren't in the pk_map and SeerProjectRepository objects get silently filtered out. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
srest2021
commented
Mar 12, 2026
| relevant for a project and any per-repo overrides (branch, instructions). | ||
| """ | ||
|
|
||
| __relocation_scope__ = RelocationScope.Global |
Member
Author
There was a problem hiding this comment.
This must be global (not organization) scope because of the repository FK. RepositorySettings model is similarly scoped to global.
JoshFerge
approved these changes
Mar 12, 2026
Member
JoshFerge
left a comment
There was a problem hiding this comment.
table schema makes sense to me.
wedamija
reviewed
Mar 12, 2026
…ranchOverride table Split branch_overrides from a JSON blob on SeerProjectRepository into a separate 1-M table for queryability and proper DB constraints. Each row stores a tag_name/tag_value/branch_name triple with a unique constraint on (seer_project_repository, tag_name, tag_value). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
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.
Fixes AIML-2603
Add a join table linking Project to Repository with per-repo Seer configuration (branch_name, instructions, branch_overrides). This is Phase 1 of migrating Seer project preferences into the Sentry DB.
Tech Spec