feat(models): Recreate CodeReviewEvent with updated schema [3/3]#109424
Draft
vaind wants to merge 1 commit intoref/delete-code-review-eventfrom
Draft
feat(models): Recreate CodeReviewEvent with updated schema [3/3]#109424vaind wants to merge 1 commit intoref/delete-code-review-eventfrom
vaind wants to merge 1 commit intoref/delete-code-review-eventfrom
Conversation
wedamija
approved these changes
Feb 26, 2026
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Moved model CodeReviewEvent to pending deletion state
--
-- (no-op)for --
-- Delete model CodeReviewEvent
--
DROP TABLE "sentry_code_review_event" CASCADE;for --
-- Create model CodeReviewEvent
--
CREATE TABLE "sentry_code_review_event" ("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, "pr_number" integer NULL, "pr_title" text NULL, "pr_author" text NULL, "pr_url" text NULL, "pr_state" varchar(16) NULL, "raw_event_type" varchar(64) NOT NULL, "raw_event_action" varchar(64) NOT NULL, "trigger_id" varchar(64) NULL, "trigger" varchar(64) NULL, "trigger_user" text NULL, "trigger_at" timestamp with time zone NOT NULL, "target_commit_sha" varchar(64) NULL, "status" varchar(32) NOT NULL, "denial_reason" text NULL, "webhook_received_at" timestamp with time zone NULL, "preflight_completed_at" timestamp with time zone NULL, "task_enqueued_at" timestamp with time zone NULL, "sent_to_seer_at" timestamp with time zone NULL, "review_started_at" timestamp with time zone NULL, "review_completed_at" timestamp with time zone NULL, "seer_run_id" varchar(64) NULL, "comments_posted" integer NULL CHECK ("comments_posted" >= 0), "review_result" jsonb NULL, "organization_id" bigint NOT NULL, "repository_id" bigint NOT NULL);
ALTER TABLE "sentry_code_review_event" ADD CONSTRAINT "sentry_code_review_e_organization_id_1ce9fe63_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_code_review_event" VALIDATE CONSTRAINT "sentry_code_review_e_organization_id_1ce9fe63_fk_sentry_or";
ALTER TABLE "sentry_code_review_event" ADD CONSTRAINT "sentry_code_review_e_repository_id_a5be62a4_fk_sentry_re" FOREIGN KEY ("repository_id") REFERENCES "sentry_repository" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_code_review_event" VALIDATE CONSTRAINT "sentry_code_review_e_repository_id_a5be62a4_fk_sentry_re";
CREATE UNIQUE INDEX CONCURRENTLY "unique_org_repo_trigger_id" ON "sentry_code_review_event" ("organization_id", "repository_id", "trigger_id") WHERE "trigger_id" IS NOT NULL;
CREATE INDEX CONCURRENTLY "sentry_code_review_event_organization_id_1ce9fe63" ON "sentry_code_review_event" ("organization_id");
CREATE INDEX CONCURRENTLY "sentry_code_review_event_repository_id_a5be62a4" ON "sentry_code_review_event" ("repository_id");
CREATE INDEX CONCURRENTLY "sentry_code_date_ad_a2451c_idx" ON "sentry_code_review_event" ("date_added");
CREATE INDEX CONCURRENTLY "sentry_code_organiz_4f4b09_idx" ON "sentry_code_review_event" ("organization_id", "trigger_at");
CREATE INDEX CONCURRENTLY "sentry_code_organiz_7ba32c_idx" ON "sentry_code_review_event" ("organization_id", "repository_id", "trigger_at");
CREATE INDEX CONCURRENTLY "sentry_code_organiz_76bbd1_idx" ON "sentry_code_review_event" ("organization_id", "repository_id", "pr_number"); |
7e4c976 to
756b38d
Compare
Recreate the CodeReviewEvent table with reviewer feedback applied: - DefaultFieldsModel base class for date_added/date_updated - FlexibleForeignKey for organization and repository (cascade deletion) - RelocationScope.Organization (data preserved during org relocation) - Backup test coverage in create_exhaustive_organization() Migration is a clean auto-generated CreateModel — no manual edits. Co-Authored-By: Claude <noreply@anthropic.com>
1fbe9a4 to
cef3689
Compare
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.
Recreate the
CodeReviewEventtable with reviewer feedback from PR #108531 applied:DefaultFieldsModelbase class for standarddate_added/date_updatedfieldsFlexibleForeignKeyfor organization and repository (cascade deletion, referential integrity)RelocationScope.Organizationso data is preserved during org relocationcreate_exhaustive_organization()Migration is a clean auto-generated
CreateModel— no manual edits.Stacked on #109422 (table deletion). Retarget to
masterafter PR 2 merges.This is PR 3 of 3:
SafeDeleteModelwithMOVE_TO_PENDINGSafeDeleteModelwithDELETE(drops the table)