Skip to content

Commit a777378

Browse files
authored
🔧 chore(data-secrecy v2): SafeDelete DataSecrecyWaiver (#95464)
1 parent 92fb5bd commit a777378

File tree

6 files changed

+34
-33
lines changed

6 files changed

+34
-33
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ preprod: 0010_actual_drop_preprod_artifact_analysis_file_id_col
2727

2828
replays: 0006_add_bulk_delete_job
2929

30-
sentry: 0949_add_dashboard_widget_snapshot_model
30+
sentry: 0950_safe_del_dswaiver
3131

3232
social_auth: 0003_social_auth_json_field
3333

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from .data_access_grant import DataAccessGrant
2-
from .datasecrecywaiver import DataSecrecyWaiver
32

43
__all__ = [
5-
"DataSecrecyWaiver",
64
"DataAccessGrant",
75
]

src/sentry/data_secrecy/models/datasecrecywaiver.py

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Generated by Django 5.2.1 on 2025-07-14 18:38
2+
3+
4+
from sentry.new_migrations.migrations import CheckedMigration
5+
from sentry.new_migrations.monkey.models import SafeDeleteModel
6+
from sentry.new_migrations.monkey.state import DeletionAction
7+
8+
9+
class Migration(CheckedMigration):
10+
# This flag is used to mark that a migration shouldn't be automatically run in production.
11+
# This should only be used for operations where it's safe to run the migration after your
12+
# code has deployed. So this should not be used for most operations that alter the schema
13+
# of a table.
14+
# Here are some things that make sense to mark as post deployment:
15+
# - Large data migrations. Typically we want these to be run manually so that they can be
16+
# monitored and not block the deploy for a long period of time while they run.
17+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
18+
# run this outside deployments so that we don't block them. Note that while adding an index
19+
# is a schema change, it's completely safe to run the operation after the code has deployed.
20+
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment
21+
22+
is_post_deployment = False
23+
24+
dependencies = [
25+
("sentry", "0949_add_dashboard_widget_snapshot_model"),
26+
]
27+
28+
operations = [
29+
SafeDeleteModel(
30+
name="DataSecrecyWaiver",
31+
deletion_action=DeletionAction.MOVE_TO_PENDING,
32+
),
33+
]

src/sentry/testutils/helpers/backups.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from sentry.backup.imports import import_in_global_scope
4040
from sentry.backup.scopes import ExportScope
4141
from sentry.backup.validate import validate
42-
from sentry.data_secrecy.models import DataSecrecyWaiver
4342
from sentry.db.models.paranoia import ParanoidModel
4443
from sentry.explore.models import (
4544
ExploreSavedQuery,
@@ -669,13 +668,6 @@ def create_exhaustive_organization(
669668
user_id=owner_id,
670669
)
671670

672-
# DataSecrecyWaiver
673-
DataSecrecyWaiver.objects.create(
674-
organization=org,
675-
access_start=timezone.now(),
676-
access_end=timezone.now() + timedelta(days=1),
677-
)
678-
679671
# Setup a test 'Issue Rule' and 'Automation'
680672
workflow = self.create_workflow(organization=org)
681673
detector = self.create_detector(project=project)

tests/sentry/db/models/test_base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from unittest import TestCase
22

3-
from sentry.data_secrecy.models import DataSecrecyWaiver
43
from sentry.db.models import DefaultFieldsModelExisting
54
from sentry.integrations.models import Integration, RepositoryProjectPathConfig
65
from sentry.models.groupsearchview import GroupSearchView
@@ -39,7 +38,6 @@ def test(self):
3938
BaseImportChunk,
4039
ControlImportChunk,
4140
ControlImportChunkReplica,
42-
DataSecrecyWaiver,
4341
GroupSearchView,
4442
Integration,
4543
NotificationSettingBase,

0 commit comments

Comments
 (0)