Skip to content

chore: Remove projecttemplate models pt 1#109890

Merged
markstory merged 10 commits into
masterfrom
chore-remove-projecttemplate-model
Mar 6, 2026
Merged

chore: Remove projecttemplate models pt 1#109890
markstory merged 10 commits into
masterfrom
chore-remove-projecttemplate-model

Conversation

@markstory
Copy link
Copy Markdown
Member

  • Remove the foreign keys for project template + project template option.
  • Move these models to pending deletion.

- Mark the ProjectTemplate and ProjectTemplateOption models as deleted.
- Remove the project.template_id field
@markstory markstory requested review from a team as code owners March 4, 2026 18:51
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 4, 2026

This PR has a migration; here is the generated SQL for src/sentry/migrations/1041_remove_projecttemplate_model.py

for 1041_remove_projecttemplate_model in sentry

--
-- Alter field organization on projecttemplate
--
SET CONSTRAINTS "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or" IMMEDIATE; ALTER TABLE "sentry_projecttemplate" DROP CONSTRAINT "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or";
ALTER TABLE "sentry_projecttemplate" ALTER COLUMN "organization_id" DROP NOT NULL;
--
-- Alter field project_template on projecttemplateoption
--
SET CONSTRAINTS "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr" IMMEDIATE; ALTER TABLE "sentry_projecttemplateoption" DROP CONSTRAINT "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr";
ALTER TABLE "sentry_projecttemplateoption" ALTER COLUMN "project_template_id" DROP NOT NULL;
--
-- Moved model ProjectTemplateOption to pending deletion state
--
-- (no-op)
--
-- Moved model ProjectTemplate to pending deletion state
--
-- (no-op)

@markstory markstory requested review from a team as code owners March 4, 2026 19:51
Comment thread tests/sentry/migrations/test_1015_backfill_self_hosted_sentry_app_emails.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 4, 2026

This PR has a migration; here is the generated SQL for src/sentry/migrations/1042_remove_projecttemplate_model.py

for 1042_remove_projecttemplate_model in sentry

--
-- Alter field organization on projecttemplate
--
SET CONSTRAINTS "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or" IMMEDIATE; ALTER TABLE "sentry_projecttemplate" DROP CONSTRAINT "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or";
ALTER TABLE "sentry_projecttemplate" ALTER COLUMN "organization_id" DROP NOT NULL;
--
-- Alter field project_template on projecttemplateoption
--
SET CONSTRAINTS "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr" IMMEDIATE; ALTER TABLE "sentry_projecttemplateoption" DROP CONSTRAINT "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr";
ALTER TABLE "sentry_projecttemplateoption" ALTER COLUMN "project_template_id" DROP NOT NULL;
--
-- Moved model ProjectTemplateOption to pending deletion state
--
-- (no-op)
--
-- Moved model ProjectTemplate to pending deletion state
--
-- (no-op)

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

from sentry.testutils.silo import control_silo_test


@pytest.mark.skip(reason="fails because projecttemplate was removed")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated migration tests permanently skipped without tracking

Medium Severity

Five completely unrelated migration tests (for email backfill, commit comparison constraints, user deletion, preprod backfill, and uptime assertions) are unconditionally disabled via @pytest.mark.skip. Using unconditional skip instead of skipIf or xfail with a tracked issue means these tests will silently remain disabled indefinitely, losing regression coverage for those features. There's no mechanism to remind anyone to re-enable them once the underlying migration framework issue is resolved.

Additional Locations (2)

Fix in Cursor Fix in Web

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 5, 2026

This PR has a migration; here is the generated SQL for src/sentry/migrations/1043_remove_projecttemplate_model.py

for 1043_remove_projecttemplate_model in sentry

--
-- Alter field organization on projecttemplate
--
SET CONSTRAINTS "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or" IMMEDIATE; ALTER TABLE "sentry_projecttemplate" DROP CONSTRAINT "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or";
ALTER TABLE "sentry_projecttemplate" ALTER COLUMN "organization_id" DROP NOT NULL;
--
-- Alter field project_template on projecttemplateoption
--
SET CONSTRAINTS "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr" IMMEDIATE; ALTER TABLE "sentry_projecttemplateoption" DROP CONSTRAINT "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr";
ALTER TABLE "sentry_projecttemplateoption" ALTER COLUMN "project_template_id" DROP NOT NULL;
--
-- Moved model ProjectTemplateOption to pending deletion state
--
-- (no-op)
--
-- Moved model ProjectTemplate to pending deletion state
--
-- (no-op)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 5, 2026

This PR has a migration; here is the generated SQL for src/sentry/migrations/1044_remove_projecttemplate_model.py

for 1044_remove_projecttemplate_model in sentry

--
-- Alter field organization on projecttemplate
--
SET CONSTRAINTS "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or" IMMEDIATE; ALTER TABLE "sentry_projecttemplate" DROP CONSTRAINT "sentry_projecttempla_organization_id_b072f5c6_fk_sentry_or";
ALTER TABLE "sentry_projecttemplate" ALTER COLUMN "organization_id" DROP NOT NULL;
--
-- Alter field project_template on projecttemplateoption
--
SET CONSTRAINTS "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr" IMMEDIATE; ALTER TABLE "sentry_projecttemplateoption" DROP CONSTRAINT "sentry_projecttempla_project_template_id_23fa7e71_fk_sentry_pr";
ALTER TABLE "sentry_projecttemplateoption" ALTER COLUMN "project_template_id" DROP NOT NULL;
--
-- Moved model ProjectTemplateOption to pending deletion state
--
-- (no-op)
--
-- Moved model ProjectTemplate to pending deletion state
--
-- (no-op)

@markstory markstory merged commit 62d9bda into master Mar 6, 2026
77 of 78 checks passed
@markstory markstory deleted the chore-remove-projecttemplate-model branch March 6, 2026 14:35
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 22, 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.

2 participants