feat(status_pages): Initial models
Lay out initial models for basic status pages
This PR has a migration; here is the generated SQL for src/sentry/status_pages/migrations/0001_initial_models.py
for 0001_initial_models in status_pages
--
-- Create model StatusPage
--
CREATE TABLE "sentry_status_page" ("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, "title" varchar(64) NOT NULL, "description" text NULL, "is_public" boolean NOT NULL, "is_accepting_subscribers" boolean NOT NULL, "cname" varchar(255) NULL, "organization_id" bigint NOT NULL);
--
-- Create model StatusUpdate
--
CREATE TABLE "sentry_status_update" ("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, "title" varchar(255) NOT NULL, "description" text NULL, "type" varchar(20) NOT NULL, "start_time" timestamp with time zone NOT NULL, "end_time" timestamp with time zone NULL, "should_notify_subscribers_now" boolean NOT NULL, "should_notify_subscribers_at_end" boolean NOT NULL, "should_notify_subscribers_24h_before" boolean NOT NULL, "parent_update_id" bigint NULL, "status_page_id" bigint NOT NULL);
--
-- Create model StatusPageDetector
--
CREATE TABLE "sentry_status_page_detector" ("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, "detector_id" bigint NOT NULL, "status_page_id" bigint NOT NULL);
--
-- Create model StatusUpdateDetector
--
CREATE TABLE "sentry_status_update_detector" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "detector_id" bigint NOT NULL, "status_update_id" bigint NOT NULL);
ALTER TABLE "sentry_status_page" ADD CONSTRAINT "sentry_status_page_organization_id_8640e8fb_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_status_page" VALIDATE CONSTRAINT "sentry_status_page_organization_id_8640e8fb_fk_sentry_or";
CREATE INDEX CONCURRENTLY "sentry_status_page_organization_id_8640e8fb" ON "sentry_status_page" ("organization_id");
ALTER TABLE "sentry_status_update" ADD CONSTRAINT "sentry_status_update_parent_update_id_c932694d_fk_sentry_st" FOREIGN KEY ("parent_update_id") REFERENCES "sentry_status_update" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_status_update" VALIDATE CONSTRAINT "sentry_status_update_parent_update_id_c932694d_fk_sentry_st";
ALTER TABLE "sentry_status_update" ADD CONSTRAINT "sentry_status_update_status_page_id_f3ce9e07_fk_sentry_st" FOREIGN KEY ("status_page_id") REFERENCES "sentry_status_page" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_status_update" VALIDATE CONSTRAINT "sentry_status_update_status_page_id_f3ce9e07_fk_sentry_st";
CREATE INDEX CONCURRENTLY "sentry_status_update_parent_update_id_c932694d" ON "sentry_status_update" ("parent_update_id");
CREATE INDEX CONCURRENTLY "sentry_status_update_status_page_id_f3ce9e07" ON "sentry_status_update" ("status_page_id");
CREATE UNIQUE INDEX CONCURRENTLY "sentry_status_page_detec_status_page_id_detector__fc29d9dc_uniq" ON "sentry_status_page_detector" ("status_page_id", "detector_id");
ALTER TABLE "sentry_status_page_detector" ADD CONSTRAINT "sentry_status_page_detec_status_page_id_detector__fc29d9dc_uniq" UNIQUE USING INDEX "sentry_status_page_detec_status_page_id_detector__fc29d9dc_uniq";
ALTER TABLE "sentry_status_page_detector" ADD CONSTRAINT "sentry_status_page_d_detector_id_5726794a_fk_workflow_" FOREIGN KEY ("detector_id") REFERENCES "workflow_engine_detector" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_status_page_detector" VALIDATE CONSTRAINT "sentry_status_page_d_detector_id_5726794a_fk_workflow_";
ALTER TABLE "sentry_status_page_detector" ADD CONSTRAINT "sentry_status_page_d_status_page_id_c1166c4c_fk_sentry_st" FOREIGN KEY ("status_page_id") REFERENCES "sentry_status_page" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_status_page_detector" VALIDATE CONSTRAINT "sentry_status_page_d_status_page_id_c1166c4c_fk_sentry_st";
CREATE INDEX CONCURRENTLY "sentry_status_page_detector_detector_id_5726794a" ON "sentry_status_page_detector" ("detector_id");
CREATE INDEX CONCURRENTLY "sentry_status_page_detector_status_page_id_c1166c4c" ON "sentry_status_page_detector" ("status_page_id");
CREATE UNIQUE INDEX CONCURRENTLY "sentry_status_update_det_status_update_id_detecto_325f09df_uniq" ON "sentry_status_update_detector" ("status_update_id", "detector_id");
ALTER TABLE "sentry_status_update_detector" ADD CONSTRAINT "sentry_status_update_det_status_update_id_detecto_325f09df_uniq" UNIQUE USING INDEX "sentry_status_update_det_status_update_id_detecto_325f09df_uniq";
ALTER TABLE "sentry_status_update_detector" ADD CONSTRAINT "sentry_status_update_detector_id_fa17786a_fk_workflow_" FOREIGN KEY ("detector_id") REFERENCES "workflow_engine_detector" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_status_update_detector" VALIDATE CONSTRAINT "sentry_status_update_detector_id_fa17786a_fk_workflow_";
ALTER TABLE "sentry_status_update_detector" ADD CONSTRAINT "sentry_status_update_status_update_id_c66eddc3_fk_sentry_st" FOREIGN KEY ("status_update_id") REFERENCES "sentry_status_update" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_status_update_detector" VALIDATE CONSTRAINT "sentry_status_update_status_update_id_c66eddc3_fk_sentry_st";
CREATE INDEX CONCURRENTLY "sentry_status_update_detector_detector_id_fa17786a" ON "sentry_status_update_detector" ("detector_id");
CREATE INDEX CONCURRENTLY "sentry_status_update_detector_status_update_id_c66eddc3" ON "sentry_status_update_detector" ("status_update_id");
:x: 9 Tests Failed:
| Tests completed | Failed | Passed | Skipped |
|---|---|---|---|
| 27175 | 9 | 27166 | 249 |
View the top 3 failed test(s) by shortest run time
tests.sentry.db.models.test_base.PreventDefaultFieldsModelExistingUseTest::testStack Traces | 0.107s run time
#x1B[1m#x1B[.../db/models/test_base.py#x1B[0m:38: in test assert self.all_subclasses(DefaultFieldsModelExisting) == { #x1B[1m#x1B[31mE AssertionError: Don't use `DefaultFieldsModelExisting` for new models - Use `DefaultFieldsModel` instead. If you're retrofitting an existing model, add it to the list in this test.#x1B[0m #x1B[1m#x1B[31mE assert {<class 'sent...Config'>, ...} == {<class 'sent...Option'>, ...}#x1B[0m #x1B[1m#x1B[31mE #x1B[0m #x1B[1m#x1B[31mE Extra items in the left set:#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.status_pages.models.status_page.StatusPage'>#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.status_pages.models.status_update.StatusUpdate'>#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.status_pages.models.status_page_detector.StatusPageDetector'>#x1B[0m #x1B[1m#x1B[31mE #x1B[0m #x1B[1m#x1B[31mE Full diff:#x1B[0m #x1B[1m#x1B[31mE {#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.groupsearchview.GroupSearchView'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.importchunk.RegionImportChunk'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.importchunk.BaseImportChunk'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.importchunk.ControlImportChunk'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.integrations.models.integration.Integration'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.importchunk.ControlImportChunkReplica'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.sentry_apps.models.sentry_app_installation_for_provider.SentryAppInstallationForProvider'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.integrations.models.repository_project_path_config.RepositoryProjectPathConfig'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.projecttemplate.ProjectTemplate'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.transaction_threshold.ProjectTransactionThresholdOverride'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.models.transaction_threshold.ProjectTransactionThreshold'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.notifications.models.notificationsettingprovider.NotificationSettingProvider'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.notifications.models.notificationsettingoption.NotificationSettingOption'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.notifications.models.notificationsettingbase.NotificationSettingBase'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.uptime.models.UptimeSubscription'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.uptime.models.ProjectUptimeSubscription'>,#x1B[0m #x1B[1m#x1B[31mE + <class 'sentry.status_pages.models.status_update.StatusUpdate'>,#x1B[0m #x1B[1m#x1B[31mE + <class 'sentry.status_pages.models.status_page.StatusPage'>,#x1B[0m #x1B[1m#x1B[31mE + <class 'sentry.status_pages.models.status_page_detector.StatusPageDetector'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.relocation.models.relocation.RelocationFile'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.relocation.models.relocation.RelocationValidation'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.relocation.models.relocation.RelocationValidationAttempt'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.data_secrecy.models.datasecrecywaiver.DataSecrecyWaiver'>,#x1B[0m #x1B[1m#x1B[31mE <class 'sentry.relocation.models.relocation.Relocation'>,#x1B[0m #x1B[1m#x1B[31mE }#x1B[0m
tests.sentry.backup.test_exports.ScopingTests::test_organization_export_scopingStack Traces | 23.2s run time
#x1B[1m#x1B[.../sentry/backup/test_exports.py#x1B[0m:263: in test_organization_export_scoping self.verify_model_inclusion(unencrypted, ExportScope.Organization) #x1B[1m#x1B[.../sentry/backup/test_exports.py#x1B[0m:182: in verify_model_inclusion raise AssertionError( #x1B[1m#x1B[31mE AssertionError: The following models were not included in the export: ${<class 'sentry.status_pages.models.status_page_detector.StatusPageDetector'>, <class 'sentry.status_pages.models.status_update.StatusUpdate'>, <class 'sentry.status_pages.models.status_update_detector.StatusUpdateDetector'>, <class 'sentry.status_pages.models.status_page.StatusPage'>}; this is despite it being included in at least one of the following relocation scopes: {<RelocationScope.User: 2>, <RelocationScope.Organization: 3>}#x1B[0m
tests.sentry.backup.test_exports.ScopingTests::test_global_export_scopingStack Traces | 23.9s run time
#x1B[1m#x1B[.../sentry/backup/test_exports.py#x1B[0m:399: in test_global_export_scoping self.verify_model_inclusion(unencrypted, ExportScope.Global) #x1B[1m#x1B[.../sentry/backup/test_exports.py#x1B[0m:182: in verify_model_inclusion raise AssertionError( #x1B[1m#x1B[31mE AssertionError: The following models were not included in the export: ${<class 'sentry.status_pages.models.status_update_detector.StatusUpdateDetector'>, <class 'sentry.status_pages.models.status_update.StatusUpdate'>, <class 'sentry.status_pages.models.status_page.StatusPage'>, <class 'sentry.status_pages.models.status_page_detector.StatusPageDetector'>}; this is despite it being included in at least one of the following relocation scopes: {<RelocationScope.Config: 4>, <RelocationScope.Global: 5>, <RelocationScope.User: 2>, <RelocationScope.Organization: 3>}#x1B[0m
To view more test analytics, go to the Test Analytics Dashboard 📋 Got 3 mins? Take this short survey to help us improve Test Analytics.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀