Skip to content

ref(migrations): Squash migrations across all apps#117834

Draft
vgrozdanic wants to merge 2 commits into
masterfrom
vjeran/squash-migrations
Draft

ref(migrations): Squash migrations across all apps#117834
vgrozdanic wants to merge 2 commits into
masterfrom
vjeran/squash-migrations

Conversation

@vgrozdanic

@vgrozdanic vgrozdanic commented Jun 16, 2026

Copy link
Copy Markdown
Member

We have collected quite a few migrations which cause random timeouts in our test suites while trying to set up the environment for the test. This should help with the start up time of the tests.

Squash all migrations into single migration files per app.

In a follow-up I will update the hard stop of the self-hosted upgrade runner as well. We had a release yesterday, and as long as we add it before next release, this should be safe.

Run locally schema diff from before and after the squash, everything looks good!

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 16, 2026
@vgrozdanic vgrozdanic changed the title ref: Squash migrations across all apps ref(migrations): Squash migrations across all apps Jun 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/notifications/migrations/0001_squashed_0012_drop_metric_alert_cols_notificationmessage.py src/sentry/preprod/migrations/0001_squashed_0030_add_images_errored_to_snapshot_comparison.py src/sentry/seer/migrations/0001_squashed_0018_backfill_seer_agent_run_group_id.py src/sentry/uptime/migrations/0001_squashed_0055_backfill_2xx_status_assertion.py

for 0001_squashed_0012_drop_metric_alert_cols_notificationmessage in notifications

--
-- Create model NotificationAction
--
CREATE TABLE "sentry_notificationaction" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "integration_id" bigint NULL, "sentry_app_id" bigint NULL, "type" smallint NOT NULL, "target_type" smallint NOT NULL, "target_identifier" text NULL, "target_display" text NULL, "trigger_type" smallint NOT NULL, "organization_id" bigint NOT NULL);
--
-- Create model NotificationActionProject
--
CREATE TABLE "sentry_notificationactionproject" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "action_id" bigint NOT NULL, "project_id" bigint NOT NULL);
--
-- Add field projects to notificationaction
--
-- (no-op)
--
-- Create model NotificationThread
--
CREATE TABLE "notifications_notificationthread" ("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, "thread_key" varchar(64) NOT NULL, "provider_key" varchar(32) NOT NULL, "target_id" varchar(255) NOT NULL, "thread_identifier" varchar(255) NOT NULL, "key_type" varchar(64) NOT NULL, "key_data" jsonb NOT NULL, "provider_data" jsonb NOT NULL, CONSTRAINT "uniq_notification_thread_per_provider_target" UNIQUE ("thread_key", "provider_key", "target_id"));
--
-- Create model NotificationMessage
--
CREATE TABLE "sentry_notificationmessage" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "error_details" text NULL, "error_code" integer NULL, "message_identifier" text NULL, "date_added" timestamp with time zone NOT NULL, "open_period_start" timestamp with time zone NULL, "action_id" bigint NOT NULL, "group_id" bigint NOT NULL, "parent_notification_message_id" bigint NULL);
--
-- Create model NotificationSettingOption
--
CREATE TABLE "sentry_notificationsettingoption" ("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 NULL, "scope_type" varchar(32) NOT NULL, "scope_identifier" bigint NOT NULL, "team_id" bigint NULL, "type" varchar(32) NOT NULL, "value" varchar(32) NOT NULL, "user_id" bigint NULL, CONSTRAINT "notification_setting_option_team_or_user_check" CHECK ((("team_id" IS NOT NULL AND "user_id" IS NULL) OR ("team_id" IS NULL AND "user_id" IS NOT NULL))));
--
-- Create model NotificationSettingProvider
--
CREATE TABLE "sentry_notificationsettingprovider" ("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 NULL, "scope_type" varchar(32) NOT NULL, "scope_identifier" bigint NOT NULL, "team_id" bigint NULL, "type" varchar(32) NOT NULL, "value" varchar(32) NOT NULL, "provider" varchar(32) NOT NULL, "user_id" bigint NULL, CONSTRAINT "notification_setting_provider_team_or_user_check" CHECK ((("team_id" IS NOT NULL AND "user_id" IS NULL) OR ("team_id" IS NULL AND "user_id" IS NOT NULL))));
--
-- Create model NotificationRecord
--
CREATE TABLE "notifications_notificationrecord" ("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, "provider_key" varchar(32) NOT NULL, "target_id" varchar(255) NOT NULL, "message_id" varchar(255) NOT NULL, "error_details" jsonb NULL, "thread_id" bigint NULL);
ALTER TABLE "sentry_notificationaction" ADD CONSTRAINT "sentry_notificationa_organization_id_799d6ceb_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_notificationaction_integration_id_c5068c68" ON "sentry_notificationaction" ("integration_id");
CREATE INDEX "sentry_notificationaction_sentry_app_id_73e20113" ON "sentry_notificationaction" ("sentry_app_id");
CREATE INDEX "sentry_notificationaction_organization_id_799d6ceb" ON "sentry_notificationaction" ("organization_id");
ALTER TABLE "sentry_notificationactionproject" ADD CONSTRAINT "sentry_notificationa_action_id_ca732506_fk_sentry_no" FOREIGN KEY ("action_id") REFERENCES "sentry_notificationaction" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_notificationactionproject" ADD CONSTRAINT "sentry_notificationa_project_id_b1a6224e_fk_sentry_pr" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_notificationactionproject_action_id_ca732506" ON "sentry_notificationactionproject" ("action_id");
CREATE INDEX "sentry_notificationactionproject_project_id_b1a6224e" ON "sentry_notificationactionproject" ("project_id");
CREATE INDEX "notifications_notificationthread_thread_key_2ef42771" ON "notifications_notificationthread" ("thread_key");
CREATE INDEX "notifications_notificationthread_thread_key_2ef42771_like" ON "notifications_notificationthread" ("thread_key" varchar_pattern_ops);
CREATE INDEX "notifications_notificationthread_key_type_88643667" ON "notifications_notificationthread" ("key_type");
CREATE INDEX "notifications_notificationthread_key_type_88643667_like" ON "notifications_notificationthread" ("key_type" varchar_pattern_ops);
ALTER TABLE "sentry_notificationmessage" ADD CONSTRAINT "sentry_notificationm_action_id_e224a327_fk_workflow_" FOREIGN KEY ("action_id") REFERENCES "workflow_engine_action" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_notificationmessage" ADD CONSTRAINT "sentry_notificationm_group_id_6e588d2d_fk_sentry_gr" FOREIGN KEY ("group_id") REFERENCES "sentry_groupedmessage" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_notificationmessage" ADD CONSTRAINT "sentry_notificationm_parent_notification__f7a9418e_fk_sentry_no" FOREIGN KEY ("parent_notification_message_id") REFERENCES "sentry_notificationmessage" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_notificationmessage_error_code_1628d967" ON "sentry_notificationmessage" ("error_code");
CREATE INDEX "sentry_notificationmessage_action_id_e224a327" ON "sentry_notificationmessage" ("action_id");
CREATE INDEX "sentry_notificationmessage_group_id_6e588d2d" ON "sentry_notificationmessage" ("group_id");
CREATE INDEX "sentry_notificationmessage_parent_notification_messag_f7a9418e" ON "sentry_notificationmessage" ("parent_notification_message_id");
CREATE INDEX "idx_notifmsg_group_action_date" ON "sentry_notificationmessage" ("group_id", "action_id", "date_added");
CREATE INDEX "sentry_noti_date_ad_ac82c5_idx" ON "sentry_notificationmessage" ("date_added");
ALTER TABLE "sentry_notificationsettingoption" ADD CONSTRAINT "sentry_notificationsetti_scope_type_scope_identif_2c82a3c2_uniq" UNIQUE ("scope_type", "scope_identifier", "user_id", "team_id", "type");
ALTER TABLE "sentry_notificationsettingoption" ADD CONSTRAINT "sentry_notifications_user_id_ec75988b_fk_auth_user" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_notificationsettingoption_team_id_85001c17" ON "sentry_notificationsettingoption" ("team_id");
CREATE INDEX "sentry_notificationsettingoption_user_id_ec75988b" ON "sentry_notificationsettingoption" ("user_id");
ALTER TABLE "sentry_notificationsettingprovider" ADD CONSTRAINT "sentry_notificationsetti_scope_type_scope_identif_864fc0b5_uniq" UNIQUE ("scope_type", "scope_identifier", "user_id", "team_id", "provider", "type");
ALTER TABLE "sentry_notificationsettingprovider" ADD CONSTRAINT "sentry_notifications_user_id_3ae08192_fk_auth_user" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_notificationsettingprovider_team_id_525df57d" ON "sentry_notificationsettingprovider" ("team_id");
CREATE INDEX "sentry_notificationsettingprovider_user_id_3ae08192" ON "sentry_notificationsettingprovider" ("user_id");
ALTER TABLE "notifications_notificationrecord" ADD CONSTRAINT "notifications_notifi_thread_id_641b82c5_fk_notificat" FOREIGN KEY ("thread_id") REFERENCES "notifications_notificationthread" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "notifications_notificationrecord_message_id_9964948e" ON "notifications_notificationrecord" ("message_id");
CREATE INDEX "notifications_notificationrecord_message_id_9964948e_like" ON "notifications_notificationrecord" ("message_id" varchar_pattern_ops);
CREATE INDEX "idx_notifrecord_thread_date" ON "notifications_notificationrecord" ("thread_id", "date_added");

for 0001_squashed_0030_add_images_errored_to_snapshot_comparison in preprod

--
-- Create model PreprodArtifact
--
CREATE TABLE "sentry_preprodartifact" ("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, "file_id" bigint NULL, "date_built" timestamp with time zone NULL, "state" integer NOT NULL CHECK ("state" >= 0), "artifact_type" integer NULL CHECK ("artifact_type" >= 0), "error_code" integer NULL CHECK ("error_code" >= 0), "error_message" text NULL, "cli_version" varchar(255) NULL, "fastlane_plugin_version" varchar(255) NULL, "gradle_plugin_version" varchar(255) NULL, "extras" jsonb NULL, "installable_app_file_id" bigint NULL, "app_id" varchar(255) NULL, "main_binary_identifier" varchar(255) NULL, "installable_app_error_code" integer NULL CHECK ("installable_app_error_code" >= 0), "installable_app_error_message" text NULL, "commit_id" bigint NULL, "commit_comparison_id" bigint NULL, "project_id" bigint NOT NULL);
--
-- Create model InstallablePreprodArtifact
--
CREATE TABLE "sentry_installablepreprodartifact" ("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, "url_path" varchar(255) NOT NULL UNIQUE, "expiration_date" timestamp with time zone NULL, "download_count" integer NULL CHECK ("download_count" >= 0), "preprod_artifact_id" bigint NOT NULL);
--
-- Create model PreprodArtifactMobileAppInfo
--
CREATE TABLE "sentry_preprodartifactmobileappinfo" ("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, "build_version" varchar(255) NULL, "build_number" bigint NULL, "app_icon_id" varchar(255) NULL, "app_name" varchar(255) NULL, "extras" jsonb NULL, "preprod_artifact_id" bigint NOT NULL UNIQUE);
--
-- Create model PreprodArtifactSizeMetrics
--
CREATE TABLE "sentry_preprodartifactsizemetrics" ("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, "metrics_artifact_type" integer NULL CHECK ("metrics_artifact_type" >= 0), "identifier" varchar(255) NULL, "state" integer NOT NULL CHECK ("state" >= 0), "error_code" integer NULL CHECK ("error_code" >= 0), "error_message" text NULL, "processing_version" varchar(255) NULL, "min_install_size" bigint NULL CHECK ("min_install_size" >= 0), "max_install_size" bigint NULL CHECK ("max_install_size" >= 0), "min_download_size" bigint NULL CHECK ("min_download_size" >= 0), "max_download_size" bigint NULL CHECK ("max_download_size" >= 0), "analysis_file_id" bigint NULL, "preprod_artifact_id" bigint NOT NULL);
--
-- Create model PreprodArtifactSizeComparison
--
CREATE TABLE "sentry_preprodartifactsizecomparison" ("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, "organization_id" bigint NOT NULL, "file_id" bigint NULL, "state" integer NOT NULL CHECK ("state" >= 0), "error_code" integer NULL CHECK ("error_code" >= 0), "error_message" text NULL, "base_size_analysis_id" bigint NOT NULL, "head_size_analysis_id" bigint NOT NULL);
--
-- Create model PreprodBuildConfiguration
--
CREATE TABLE "sentry_preprodbuildconfiguration" ("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, "name" varchar(255) NOT NULL, "project_id" bigint NOT NULL);
--
-- Add field build_configuration to preprodartifact
--
ALTER TABLE "sentry_preprodartifact" ADD COLUMN "build_configuration_id" bigint NULL CONSTRAINT "sentry_preprodartifa_build_configuration__ed071cfe_fk_sentry_pr" REFERENCES "sentry_preprodbuildconfiguration"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "sentry_preprodartifa_build_configuration__ed071cfe_fk_sentry_pr" IMMEDIATE;
--
-- Create model PreprodComparisonApproval
--
CREATE TABLE "sentry_preprodcomparisonapproval" ("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, "preprod_feature_type" integer NOT NULL CHECK ("preprod_feature_type" >= 0), "approval_status" integer NOT NULL CHECK ("approval_status" >= 0), "approved_at" timestamp with time zone NULL, "approved_by_id" bigint NULL, "extras" jsonb NULL, "preprod_artifact_id" bigint NOT NULL);
--
-- Create model PreprodSnapshotMetrics
--
CREATE TABLE "sentry_preprodsnapshotmetrics" ("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, "image_count" integer NOT NULL CHECK ("image_count" >= 0), "is_selective" boolean DEFAULT false NOT NULL, "extras" jsonb NULL, "preprod_artifact_id" bigint NOT NULL UNIQUE);
--
-- Create model PreprodSnapshotComparison
--
CREATE TABLE "sentry_preprodsnapshotcomparison" ("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, "state" integer NOT NULL CHECK ("state" >= 0), "error_code" integer NULL CHECK ("error_code" >= 0), "error_message" text NULL, "images_added" integer NOT NULL CHECK ("images_added" >= 0), "images_removed" integer NOT NULL CHECK ("images_removed" >= 0), "images_changed" integer NOT NULL CHECK ("images_changed" >= 0), "images_unchanged" integer NOT NULL CHECK ("images_unchanged" >= 0), "images_renamed" integer NOT NULL CHECK ("images_renamed" >= 0), "images_skipped" integer DEFAULT 0 NOT NULL CHECK ("images_skipped" >= 0), "images_errored" integer DEFAULT 0 NOT NULL CHECK ("images_errored" >= 0), "chunks_total" integer NULL CHECK ("chunks_total" >= 0), "chunks_done_indices" integer[] DEFAULT '{}'::integer[] NOT NULL, "extras" jsonb NULL, "base_snapshot_metrics_id" bigint NOT NULL, "head_snapshot_metrics_id" bigint NOT NULL);
--
-- Create constraint preprod_artifact_size_metrics_unique on model preprodartifactsizemetrics
--
CREATE UNIQUE INDEX "preprod_artifact_size_metrics_unique" ON "sentry_preprodartifactsizemetrics" ("preprod_artifact_id", "metrics_artifact_type", "identifier") WHERE "identifier" IS NOT NULL;
--
-- Create constraint preprod_artifact_size_metrics_unique_no_identifier on model preprodartifactsizemetrics
--
CREATE UNIQUE INDEX "preprod_artifact_size_metrics_unique_no_identifier" ON "sentry_preprodartifactsizemetrics" ("preprod_artifact_id", "metrics_artifact_type") WHERE "identifier" IS NULL;
--
-- Alter unique_together for preprodartifactsizecomparison (1 constraint(s))
--
ALTER TABLE "sentry_preprodartifactsizecomparison" ADD CONSTRAINT "sentry_preprodartifactsi_organization_id_head_siz_ee2086a2_uniq" UNIQUE ("organization_id", "head_size_analysis_id", "base_size_analysis_id");
--
-- Alter unique_together for preprodbuildconfiguration (1 constraint(s))
--
ALTER TABLE "sentry_preprodbuildconfiguration" ADD CONSTRAINT "sentry_preprodbuildconfiguration_project_id_name_aa024645_uniq" UNIQUE ("project_id", "name");
--
-- Create index sentry_prep_project_c6742d_idx on field(s) project, date_added of model preprodartifact
--
CREATE INDEX "sentry_prep_project_c6742d_idx" ON "sentry_preprodartifact" ("project_id", "date_added");
--
-- Alter unique_together for preprodsnapshotcomparison (1 constraint(s))
--
ALTER TABLE "sentry_preprodsnapshotcomparison" ADD CONSTRAINT "sentry_preprodsnapshotco_head_snapshot_metrics_id_5e318dcf_uniq" UNIQUE ("head_snapshot_metrics_id", "base_snapshot_metrics_id");
ALTER TABLE "sentry_preprodartifact" ADD CONSTRAINT "sentry_preprodartifa_commit_comparison_id_3acf2d9f_fk_sentry_co" FOREIGN KEY ("commit_comparison_id") REFERENCES "sentry_commitcomparison" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_preprodartifact" ADD CONSTRAINT "sentry_preprodartifact_project_id_ea7579b7_fk_sentry_project_id" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_preprodartifact_file_id_d5007350" ON "sentry_preprodartifact" ("file_id");
CREATE INDEX "sentry_preprodartifact_installable_app_file_id_26dbfd18" ON "sentry_preprodartifact" ("installable_app_file_id");
CREATE INDEX "sentry_preprodartifact_main_binary_identifier_97f62eea" ON "sentry_preprodartifact" ("main_binary_identifier");
CREATE INDEX "sentry_preprodartifact_main_binary_identifier_97f62eea_like" ON "sentry_preprodartifact" ("main_binary_identifier" varchar_pattern_ops);
CREATE INDEX "sentry_preprodartifact_commit_id_97171e7d" ON "sentry_preprodartifact" ("commit_id");
CREATE INDEX "sentry_preprodartifact_commit_comparison_id_3acf2d9f" ON "sentry_preprodartifact" ("commit_comparison_id");
CREATE INDEX "sentry_preprodartifact_project_id_ea7579b7" ON "sentry_preprodartifact" ("project_id");
ALTER TABLE "sentry_installablepreprodartifact" ADD CONSTRAINT "sentry_installablepr_preprod_artifact_id_84bd1468_fk_sentry_pr" FOREIGN KEY ("preprod_artifact_id") REFERENCES "sentry_preprodartifact" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_installablepreprodartifact_url_path_62642e92_like" ON "sentry_installablepreprodartifact" ("url_path" varchar_pattern_ops);
CREATE INDEX "sentry_installablepreprodartifact_preprod_artifact_id_84bd1468" ON "sentry_installablepreprodartifact" ("preprod_artifact_id");
ALTER TABLE "sentry_preprodartifactmobileappinfo" ADD CONSTRAINT "sentry_preprodartifa_preprod_artifact_id_677ffff0_fk_sentry_pr" FOREIGN KEY ("preprod_artifact_id") REFERENCES "sentry_preprodartifact" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_preprodartifactsizemetrics" ADD CONSTRAINT "sentry_preprodartifa_preprod_artifact_id_5ddef58c_fk_sentry_pr" FOREIGN KEY ("preprod_artifact_id") REFERENCES "sentry_preprodartifact" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_preprodartifactsizemetrics_analysis_file_id_f7c6d67f" ON "sentry_preprodartifactsizemetrics" ("analysis_file_id");
CREATE INDEX "sentry_preprodartifactsizemetrics_preprod_artifact_id_5ddef58c" ON "sentry_preprodartifactsizemetrics" ("preprod_artifact_id");
ALTER TABLE "sentry_preprodartifactsizecomparison" ADD CONSTRAINT "sentry_preprodartifa_base_size_analysis_i_e047ac35_fk_sentry_pr" FOREIGN KEY ("base_size_analysis_id") REFERENCES "sentry_preprodartifactsizemetrics" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_preprodartifactsizecomparison" ADD CONSTRAINT "sentry_preprodartifa_head_size_analysis_i_c99516d1_fk_sentry_pr" FOREIGN KEY ("head_size_analysis_id") REFERENCES "sentry_preprodartifactsizemetrics" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_preprodartifactsizecomparison_organization_id_95a0c1f2" ON "sentry_preprodartifactsizecomparison" ("organization_id");
CREATE INDEX "sentry_preprodartifactsizecomparison_file_id_9e14c89d" ON "sentry_preprodartifactsizecomparison" ("file_id");
CREATE INDEX "sentry_preprodartifactsize_base_size_analysis_id_e047ac35" ON "sentry_preprodartifactsizecomparison" ("base_size_analysis_id");
CREATE INDEX "sentry_preprodartifactsize_head_size_analysis_id_c99516d1" ON "sentry_preprodartifactsizecomparison" ("head_size_analysis_id");
ALTER TABLE "sentry_preprodbuildconfiguration" ADD CONSTRAINT "sentry_preprodbuildc_project_id_bc1f93ff_fk_sentry_pr" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_preprodbuildconfiguration_project_id_bc1f93ff" ON "sentry_preprodbuildconfiguration" ("project_id");
CREATE INDEX "sentry_preprodartifact_build_configuration_id_ed071cfe" ON "sentry_preprodartifact" ("build_configuration_id");
ALTER TABLE "sentry_preprodcomparisonapproval" ADD CONSTRAINT "sentry_preprodcompar_preprod_artifact_id_fb9ddfd7_fk_sentry_pr" FOREIGN KEY ("preprod_artifact_id") REFERENCES "sentry_preprodartifact" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_preprodcomparisonapproval_approved_by_id_8506b511" ON "sentry_preprodcomparisonapproval" ("approved_by_id");
CREATE INDEX "sentry_preprodcomparisonapproval_preprod_artifact_id_fb9ddfd7" ON "sentry_preprodcomparisonapproval" ("preprod_artifact_id");
ALTER TABLE "sentry_preprodsnapshotmetrics" ADD CONSTRAINT "sentry_preprodsnapsh_preprod_artifact_id_848e8caf_fk_sentry_pr" FOREIGN KEY ("preprod_artifact_id") REFERENCES "sentry_preprodartifact" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_preprodsnapshotcomparison" ADD CONSTRAINT "sentry_preprodsnapsh_base_snapshot_metric_4d7d08c0_fk_sentry_pr" FOREIGN KEY ("base_snapshot_metrics_id") REFERENCES "sentry_preprodsnapshotmetrics" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "sentry_preprodsnapshotcomparison" ADD CONSTRAINT "sentry_preprodsnapsh_head_snapshot_metric_a2fe43bf_fk_sentry_pr" FOREIGN KEY ("head_snapshot_metrics_id") REFERENCES "sentry_preprodsnapshotmetrics" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "sentry_preprodsnapshotcomp_base_snapshot_metrics_id_4d7d08c0" ON "sentry_preprodsnapshotcomparison" ("base_snapshot_metrics_id");
CREATE INDEX "sentry_preprodsnapshotcomp_head_snapshot_metrics_id_a2fe43bf" ON "sentry_preprodsnapshotcomparison" ("head_snapshot_metrics_id");

for 0001_squashed_0018_backfill_seer_agent_run_group_id in seer

--
-- Create model SeerNightShiftRun
--
CREATE TABLE "seer_nightshiftrun" ("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, "extras" jsonb DEFAULT '{}'::jsonb NOT NULL, "organization_id" bigint NOT NULL);
--
-- 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_repository_id" bigint NOT NULL UNIQUE);
--
-- Create model SeerRun
--
CREATE TABLE "seer_seerrun" ("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, "user_id" bigint NULL, "uuid" uuid NOT NULL UNIQUE, "seer_run_state_id" bigint NULL UNIQUE, "type" varchar(256) NOT NULL, "mirror_status" varchar(256) DEFAULT 'pending' NOT NULL, "last_triggered_at" timestamp with time zone NOT NULL, "extras" jsonb DEFAULT '{}'::jsonb NOT NULL, "organization_id" bigint NOT NULL);
--
-- Create model SeerNightShiftRunResult
--
CREATE TABLE "seer_nightshiftrunissue" ("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, "kind" varchar(256) NOT NULL, "seer_run_id" text NULL, "extras" jsonb DEFAULT '{}'::jsonb NOT NULL, "group_id" bigint NULL, "run_id" bigint NOT NULL, "result_seer_run_id" bigint NULL);
--
-- Add field seer_run to seernightshiftrun
--
ALTER TABLE "seer_nightshiftrun" ADD COLUMN "seer_run_id" bigint NULL CONSTRAINT "seer_nightshiftrun_seer_run_id_c8367325_fk_seer_seerrun_id" REFERENCES "seer_seerrun"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "seer_nightshiftrun_seer_run_id_c8367325_fk_seer_seerrun_id" IMMEDIATE;
--
-- Create model SeerAgentRun
--
CREATE TABLE "seer_seeragentrun" ("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, "title" varchar(256) NOT NULL, "source" varchar(256) NOT NULL, "extras" jsonb DEFAULT '{}'::jsonb NOT NULL, "group_id" bigint NULL, "project_id" bigint NULL, "run_id" bigint NOT NULL UNIQUE);
--
-- Create model SeerWorkflowConfig
--
CREATE TABLE "seer_workflowconfig" ("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, "strategy" varchar(256) NOT NULL, "enabled" boolean NOT NULL, "schedule" varchar(256) NOT NULL, "extras" jsonb DEFAULT '{}'::jsonb NOT NULL, "organization_id" bigint NOT NULL);
--
-- Add field workflow_config to seernightshiftrun
--
ALTER TABLE "seer_nightshiftrun" ADD COLUMN "workflow_config_id" bigint NULL CONSTRAINT "seer_nightshiftrun_workflow_config_id_a849d36c_fk_seer_work" REFERENCES "seer_workflowconfig"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "seer_nightshiftrun_workflow_config_id_a849d36c_fk_seer_work" IMMEDIATE;
--
-- 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 index seer_seerru_organiz_c90199_idx on field(s) organization, -last_triggered_at of model seerrun
--
CREATE INDEX "seer_seerru_organiz_c90199_idx" ON "seer_seerrun" ("organization_id", "last_triggered_at" DESC);
--
-- Create index seer_seerru_organiz_8b7357_idx on field(s) organization, user_id, -last_triggered_at of model seerrun
--
CREATE INDEX "seer_seerru_organiz_8b7357_idx" ON "seer_seerrun" ("organization_id", "user_id", "last_triggered_at" DESC);
--
-- Create index seer_seerru_organiz_eb75f1_idx on field(s) organization, type, -last_triggered_at of model seerrun
--
CREATE INDEX "seer_seerru_organiz_eb75f1_idx" ON "seer_seerrun" ("organization_id", "type", "last_triggered_at" DESC);
--
-- Create index seer_seerru_last_tr_9581cc_idx on field(s) last_triggered_at of model seerrun
--
CREATE INDEX "seer_seerru_last_tr_9581cc_idx" ON "seer_seerrun" ("last_triggered_at");
--
-- Create index seer_nights_run_id_d5406e_idx on field(s) run, kind of model seernightshiftrunresult
--
CREATE INDEX "seer_nights_run_id_d5406e_idx" ON "seer_nightshiftrunissue" ("run_id", "kind");
--
-- Create constraint seer_workflowconfig_org_strategy_uniq on model seerworkflowconfig
--
ALTER TABLE "seer_workflowconfig" ADD CONSTRAINT "seer_workflowconfig_org_strategy_uniq" UNIQUE ("organization_id", "strategy");
--
-- Create index seer_nights_organiz_6ebf9f_idx on field(s) organization, date_added of model seernightshiftrun
--
CREATE INDEX "seer_nights_organiz_6ebf9f_idx" ON "seer_nightshiftrun" ("organization_id", "date_added");
--
-- Create index seer_nights_date_ad_1d7b62_idx on field(s) date_added of model seernightshiftrun
--
CREATE INDEX "seer_nights_date_ad_1d7b62_idx" ON "seer_nightshiftrun" ("date_added");
--
-- Create index seer_nights_workflo_e31f62_idx on field(s) workflow_config, date_added of model seernightshiftrun
--
CREATE INDEX "seer_nights_workflo_e31f62_idx" ON "seer_nightshiftrun" ("workflow_config_id", "date_added");
ALTER TABLE "seer_nightshiftrun" ADD CONSTRAINT "seer_nightshiftrun_organization_id_2645dd62_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "seer_nightshiftrun_organization_id_2645dd62" ON "seer_nightshiftrun" ("organization_id");
ALTER TABLE "seer_projectrepository" ADD CONSTRAINT "seer_projectreposito_project_repository_i_bff6d0fe_fk_sentry_pr" FOREIGN KEY ("project_repository_id") REFERENCES "sentry_projectrepository" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "seer_seerrun" ADD CONSTRAINT "seer_seerrun_organization_id_e500e42f_fk_sentry_organization_id" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "seer_seerrun_user_id_1a2f879d" ON "seer_seerrun" ("user_id");
CREATE INDEX "seer_seerrun_organization_id_e500e42f" ON "seer_seerrun" ("organization_id");
ALTER TABLE "seer_nightshiftrunissue" ADD CONSTRAINT "seer_nightshiftrunis_run_id_8c1e4d99_fk_seer_nigh" FOREIGN KEY ("run_id") REFERENCES "seer_nightshiftrun" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "seer_nightshiftrunissue" ADD CONSTRAINT "seer_nightshiftrunis_result_seer_run_id_94035eb3_fk_seer_seer" FOREIGN KEY ("result_seer_run_id") REFERENCES "seer_seerrun" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "seer_nightshiftrunissue_group_id_b6803eaf" ON "seer_nightshiftrunissue" ("group_id");
CREATE INDEX "seer_nightshiftrunissue_run_id_8c1e4d99" ON "seer_nightshiftrunissue" ("run_id");
CREATE INDEX "seer_nightshiftrunissue_result_seer_run_id_94035eb3" ON "seer_nightshiftrunissue" ("result_seer_run_id");
CREATE INDEX "seer_nightshiftrun_seer_run_id_c8367325" ON "seer_nightshiftrun" ("seer_run_id");
ALTER TABLE "seer_seeragentrun" ADD CONSTRAINT "seer_seeragentrun_run_id_531cc2b6_fk_seer_seerrun_id" FOREIGN KEY ("run_id") REFERENCES "seer_seerrun" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "seer_seeragentrun_group_id_d46cce48" ON "seer_seeragentrun" ("group_id");
CREATE INDEX "seer_seeragentrun_project_id_15df602d" ON "seer_seeragentrun" ("project_id");
ALTER TABLE "seer_workflowconfig" ADD CONSTRAINT "seer_workflowconfig_organization_id_b1e0450a_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "seer_workflowconfig_organization_id_b1e0450a" ON "seer_workflowconfig" ("organization_id");
CREATE INDEX "seer_nightshiftrun_workflow_config_id_a849d36c" ON "seer_nightshiftrun" ("workflow_config_id");
ALTER TABLE "seer_projectrepositorybranchoverride" ADD CONSTRAINT "seer_projectrepositorybr_seer_project_repository__e53d101f_uniq" UNIQUE ("seer_project_repository_id", "tag_name", "tag_value");
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;
CREATE INDEX "seer_projectrepositorybran_seer_project_repository_id_b6516aa2" ON "seer_projectrepositorybranchoverride" ("seer_project_repository_id");

for 0001_squashed_0055_backfill_2xx_status_assertion in uptime

--
-- Create model UptimeSubscription
--
CREATE TABLE "uptime_uptimesubscription" ("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 NULL, "type" text NOT NULL, "status" smallint DEFAULT 0 NOT NULL, "subscription_id" text NULL UNIQUE, "url" varchar(255) NOT NULL, "url_domain" varchar(255) DEFAULT '' NOT NULL, "url_domain_suffix" varchar(255) DEFAULT '' NOT NULL, "host_provider_id" varchar(255) NULL, "host_provider_name" varchar(255) NULL, "interval_seconds" integer NOT NULL, "timeout_ms" integer NOT NULL, "method" varchar(20) DEFAULT 'GET' NOT NULL, "headers" jsonb DEFAULT '[]'::jsonb NOT NULL, "body" text NULL, "trace_sampling" boolean DEFAULT false NOT NULL, "response_capture_enabled" boolean DEFAULT true NOT NULL, "capture_response_on_failure" boolean DEFAULT true NOT NULL, "assertion" jsonb NULL);
--
-- Create model UptimeResponseCapture
--
CREATE TABLE "uptime_uptimeresponsecapture" ("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, "file_id" bigint NOT NULL, "scheduled_check_time_ms" bigint NOT NULL, "uptime_subscription_id" bigint NOT NULL);
--
-- Create model UptimeSubscriptionRegion
--
CREATE TABLE "uptime_uptimesubscriptionregion" ("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, "region_slug" varchar(255) DEFAULT '' NOT NULL, "mode" varchar(32) DEFAULT 'active' NOT NULL, "uptime_subscription_id" bigint NOT NULL);
CREATE INDEX "uptime_uptimesubscription_subscription_id_b92790c8_like" ON "uptime_uptimesubscription" ("subscription_id" text_pattern_ops);
CREATE INDEX "uptime_uptimesubscription_host_provider_id_215a0585" ON "uptime_uptimesubscription" ("host_provider_id");
CREATE INDEX "uptime_uptimesubscription_host_provider_id_215a0585_like" ON "uptime_uptimesubscription" ("host_provider_id" varchar_pattern_ops);
CREATE INDEX "uptime_uptimesubscription_host_provider_name_d9a220d0" ON "uptime_uptimesubscription" ("host_provider_name");
CREATE INDEX "uptime_uptimesubscription_host_provider_name_d9a220d0_like" ON "uptime_uptimesubscription" ("host_provider_name" varchar_pattern_ops);
CREATE INDEX "uptime_upti_url_dom_ead522_idx" ON "uptime_uptimesubscription" ("url_domain_suffix", "url_domain");
ALTER TABLE "uptime_uptimeresponsecapture" ADD CONSTRAINT "uptime_uptimerespons_uptime_subscription__27b6838c_fk_uptime_up" FOREIGN KEY ("uptime_subscription_id") REFERENCES "uptime_uptimesubscription" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "uptime_uptimeresponsecapture_uptime_subscription_id_27b6838c" ON "uptime_uptimeresponsecapture" ("uptime_subscription_id");
CREATE INDEX "uptime_upti_uptime__aa1fbe_idx" ON "uptime_uptimeresponsecapture" ("uptime_subscription_id", "scheduled_check_time_ms");
CREATE INDEX "uptime_upti_date_ad_d591fd_idx" ON "uptime_uptimeresponsecapture" ("date_added");
ALTER TABLE "uptime_uptimesubscriptionregion" ADD CONSTRAINT "uptime_uptimesubscri_uptime_subscription__deb3e935_fk_uptime_up" FOREIGN KEY ("uptime_subscription_id") REFERENCES "uptime_uptimesubscription" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE UNIQUE INDEX "uptime_uptimesubscription_region_slug_unique" ON "uptime_uptimesubscriptionregion" ("uptime_subscription_id", "region_slug");
CREATE INDEX "uptime_uptimesubscriptionregion_region_slug_398beca2" ON "uptime_uptimesubscriptionregion" ("region_slug");
CREATE INDEX "uptime_uptimesubscriptionregion_region_slug_398beca2_like" ON "uptime_uptimesubscriptionregion" ("region_slug" varchar_pattern_ops);
CREATE INDEX "uptime_uptimesubscriptionregion_uptime_subscription_id_deb3e935" ON "uptime_uptimesubscriptionregion" ("uptime_subscription_id");

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

Squash all migrations into single migration files per app. Replaces 379 individual migration files with 13 squashed migrations plus updates to 2 existing squashed files and the lockfile.
@vgrozdanic vgrozdanic force-pushed the vjeran/squash-migrations branch from 92b9958 to 3428acb Compare June 16, 2026 21:25
…reference each other

The _cleared_deps restore step only looked up dependency targets in the
squash dict (apps being squashed now), but after a bulk squash, an
already-squashed app can depend on another already-squashed app (e.g.
discover -> explore). Build a combined lookup from both already_squashed
and squash so the dependency rewrite works for any app.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant