Skip to content

feat(preprod): Create initial preprod snapshots models#106823

Merged
rbro112 merged 3 commits intomasterfrom
ryan/create_initial_preprod_snapshots_models
Jan 23, 2026
Merged

feat(preprod): Create initial preprod snapshots models#106823
rbro112 merged 3 commits intomasterfrom
ryan/create_initial_preprod_snapshots_models

Conversation

@rbro112
Copy link
Copy Markdown
Member

@rbro112 rbro112 commented Jan 22, 2026

Creates new snapshots DB models for upcoming Emerge snapshots integration. Nested in a /snapshots folder to try to start organizing by product surface.

@rbro112 rbro112 requested a review from a team as a code owner January 22, 2026 20:36
Copy link
Copy Markdown
Member Author

rbro112 commented Jan 22, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 22, 2026
@rbro112 rbro112 changed the title Create initial preprod snapshots models feat(preprod): Create initial preprod snapshots models Jan 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 22, 2026

This PR has a migration; here is the generated SQL for src/sentry/preprod/migrations/0026_add_initial_snapshot_models.py

for 0026_add_initial_snapshot_models in preprod

--
-- 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), "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), "extras" jsonb NULL, "base_snapshot_metrics_id" bigint NOT NULL, "head_snapshot_metrics_id" bigint NOT NULL);
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 NOT VALID;
ALTER TABLE "sentry_preprodsnapshotmetrics" VALIDATE CONSTRAINT "sentry_preprodsnapsh_preprod_artifact_id_848e8caf_fk_sentry_pr";
CREATE UNIQUE INDEX CONCURRENTLY "sentry_preprodsnapshotco_head_snapshot_metrics_id_5e318dcf_uniq" ON "sentry_preprodsnapshotcomparison" ("head_snapshot_metrics_id", "base_snapshot_metrics_id");
ALTER TABLE "sentry_preprodsnapshotcomparison" ADD CONSTRAINT "sentry_preprodsnapshotco_head_snapshot_metrics_id_5e318dcf_uniq" UNIQUE USING INDEX "sentry_preprodsnapshotco_head_snapshot_metrics_id_5e318dcf_uniq";
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 NOT VALID;
ALTER TABLE "sentry_preprodsnapshotcomparison" VALIDATE CONSTRAINT "sentry_preprodsnapsh_base_snapshot_metric_4d7d08c0_fk_sentry_pr";
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 NOT VALID;
ALTER TABLE "sentry_preprodsnapshotcomparison" VALIDATE CONSTRAINT "sentry_preprodsnapsh_head_snapshot_metric_a2fe43bf_fk_sentry_pr";
CREATE INDEX CONCURRENTLY "sentry_preprodsnapshotcomp_base_snapshot_metrics_id_4d7d08c0" ON "sentry_preprodsnapshotcomparison" ("base_snapshot_metrics_id");
CREATE INDEX CONCURRENTLY "sentry_preprodsnapshotcomp_head_snapshot_metrics_id_a2fe43bf" ON "sentry_preprodsnapshotcomparison" ("head_snapshot_metrics_id");

Comment thread src/sentry/preprod/snapshots/models.py Outdated
Comment thread src/sentry/preprod/snapshots/models.py
Comment thread src/sentry/preprod/snapshots/models.py Outdated
Comment thread src/sentry/preprod/snapshots/models.py
@rbro112 rbro112 force-pushed the ryan/create_initial_preprod_snapshots_models branch from 295179a to cdce9e3 Compare January 23, 2026 19:33
@rbro112 rbro112 merged commit e0fef19 into master Jan 23, 2026
91 of 92 checks passed
@rbro112 rbro112 deleted the ryan/create_initial_preprod_snapshots_models branch January 23, 2026 21:09
JonasBa pushed a commit that referenced this pull request Jan 27, 2026
Creates new snapshots DB models for upcoming Emerge snapshots
integration. Nested in a `/snapshots` folder to try to start organizing
by product surface.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants