|
| 1 | +# Generated by Django 5.1.7 on 2025-04-01 20:22 |
| 2 | + |
| 3 | +from django.db import migrations |
| 4 | + |
| 5 | +from sentry.new_migrations.migrations import CheckedMigration |
| 6 | +from sentry.new_migrations.monkey.special import SafeRunSQL |
| 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", "0856_monitors_remove_type_column_state"), |
| 26 | + ] |
| 27 | + |
| 28 | + operations = [ |
| 29 | + migrations.RemoveConstraint( |
| 30 | + model_name="groupopenperiod", |
| 31 | + name="exclude_open_period_overlap", |
| 32 | + ), |
| 33 | + SafeRunSQL( |
| 34 | + """ALTER TABLE "sentry_groupopenperiod" |
| 35 | + ADD CONSTRAINT "exclude_open_period_overlap" EXCLUDE USING GIST ( |
| 36 | + "group_id" gist_int8_ops WITH =, |
| 37 | + (TSTZRANGE("date_started", "date_ended", '[)')) WITH && |
| 38 | + );""", |
| 39 | + use_statement_timeout=False, |
| 40 | + hints={"tables": ["sentry_groupopenperiod"]}, |
| 41 | + ), |
| 42 | + ] |
0 commit comments