Skip to content

Commit 73f394f

Browse files
committed
ref(migrations): Drop {next,last}_checkin columns (db op)
Follow up to #49132
1 parent f491acd commit 73f394f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ To resolve this, rebase against latest master and regenerate your migration. Thi
66
will then be regenerated, and you should be able to merge without conflicts.
77

88
nodestore: 0002_nodestore_no_dictfield
9-
sentry: 0444_remove_next_checkin_last_checkin_from_monitor
9+
sentry: 0445_drop_deprecated_monitor_next_last_checkin_db_op
1010
social_auth: 0001_initial
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Generated by Django 2.2.28 on 2023-05-16 21:28
2+
3+
from django.db import migrations
4+
5+
from sentry.new_migrations.migrations import CheckedMigration
6+
7+
8+
class Migration(CheckedMigration):
9+
# This flag is used to mark that a migration shouldn't be automatically run in production. For
10+
# the most part, this should only be used for operations where it's safe to run the migration
11+
# after your code has deployed. So this should not be used for most operations that alter the
12+
# schema of a table.
13+
# Here are some things that make sense to mark as dangerous:
14+
# - Large data migrations. Typically we want these to be run manually by ops so that they can
15+
# be monitored and not block the deploy for a long period of time while they run.
16+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
17+
# have ops run this and not block the deploy. Note that while adding an index is a schema
18+
# change, it's completely safe to run the operation after the code has deployed.
19+
is_dangerous = False
20+
21+
22+
dependencies = [
23+
('sentry', '0444_remove_next_checkin_last_checkin_from_monitor'),
24+
]
25+
26+
operations = [
27+
migrations.SeparateDatabaseAndState(
28+
database_operations=[
29+
migrations.RunSQL(
30+
"""
31+
ALTER TABLE "sentry_monitor" DROP COLUMN "last_checkin";
32+
ALTER TABLE "sentry_monitor" DROP COLUMN "next_checkin";
33+
""",
34+
reverse_sql="""
35+
ALTER TABLE "sentry_monitor" ADD COLUMN "last_checkin" timestamp with time zone NULL;
36+
ALTER TABLE "sentry_monitor" ADD COLUMN "next_checkin" timestamp with time zone NULL;
37+
""",
38+
hints={"tables": ["sentry_monitor"]},
39+
)
40+
],
41+
state_operations=[],
42+
)
43+
]

0 commit comments

Comments
 (0)