|
| 1 | +# Generated by Django 5.2.14 on 2026-06-17 18:15 |
| 2 | + |
| 3 | +import django.db.models.deletion |
| 4 | +import sentry.db.models.fields.bounded |
| 5 | +import sentry.db.models.fields.foreignkey |
| 6 | +import sentry.db.models.fields.hybrid_cloud_foreign_key |
| 7 | +from django.db import migrations, models |
| 8 | + |
| 9 | +from sentry.new_migrations.migrations import CheckedMigration |
| 10 | + |
| 11 | + |
| 12 | +class Migration(CheckedMigration): |
| 13 | + # This flag is used to mark that a migration shouldn't be automatically run in production. |
| 14 | + # This should only be used for operations where it's safe to run the migration after your |
| 15 | + # code has deployed. So this should not be used for most operations that alter the schema |
| 16 | + # of a table. |
| 17 | + # Here are some things that make sense to mark as post deployment: |
| 18 | + # - Large data migrations. Typically we want these to be run manually so that they can be |
| 19 | + # monitored and not block the deploy for a long period of time while they run. |
| 20 | + # - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to |
| 21 | + # run this outside deployments so that we don't block them. Note that while adding an index |
| 22 | + # is a schema change, it's completely safe to run the operation after the code has deployed. |
| 23 | + # Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment |
| 24 | + |
| 25 | + is_post_deployment = False |
| 26 | + |
| 27 | + dependencies = [ |
| 28 | + ("explore", "0008_add_trace_item_attribute_context"), |
| 29 | + ("sentry", "1117_drop_organizationmapping_codecov_access_delete"), |
| 30 | + ] |
| 31 | + |
| 32 | + operations = [ |
| 33 | + migrations.CreateModel( |
| 34 | + name="TraceItemAttributeValueContext", |
| 35 | + fields=[ |
| 36 | + ( |
| 37 | + "id", |
| 38 | + sentry.db.models.fields.bounded.BoundedBigAutoField( |
| 39 | + primary_key=True, serialize=False |
| 40 | + ), |
| 41 | + ), |
| 42 | + ("date_updated", models.DateTimeField(auto_now=True)), |
| 43 | + ("date_added", models.DateTimeField(auto_now_add=True)), |
| 44 | + ("attribute_name", models.CharField()), |
| 45 | + ("attribute_value", models.CharField()), |
| 46 | + ( |
| 47 | + "attribute_type", |
| 48 | + sentry.db.models.fields.bounded.BoundedPositiveIntegerField(), |
| 49 | + ), |
| 50 | + ( |
| 51 | + "item_type", |
| 52 | + sentry.db.models.fields.bounded.BoundedPositiveIntegerField(), |
| 53 | + ), |
| 54 | + ("brief", models.CharField(max_length=280, null=True)), |
| 55 | + ("additional_context", models.TextField(null=True)), |
| 56 | + ( |
| 57 | + "created_by_id", |
| 58 | + sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( |
| 59 | + "sentry.User", db_index=True, null=True, on_delete="SET_NULL" |
| 60 | + ), |
| 61 | + ), |
| 62 | + ( |
| 63 | + "updated_by_id", |
| 64 | + sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( |
| 65 | + "sentry.User", db_index=True, null=True, on_delete="SET_NULL" |
| 66 | + ), |
| 67 | + ), |
| 68 | + ("last_received", models.DateTimeField(null=True)), |
| 69 | + ( |
| 70 | + "organization", |
| 71 | + sentry.db.models.fields.foreignkey.FlexibleForeignKey( |
| 72 | + on_delete=django.db.models.deletion.CASCADE, |
| 73 | + to="sentry.organization", |
| 74 | + ), |
| 75 | + ), |
| 76 | + ( |
| 77 | + "project", |
| 78 | + sentry.db.models.fields.foreignkey.FlexibleForeignKey( |
| 79 | + null=True, |
| 80 | + on_delete=django.db.models.deletion.CASCADE, |
| 81 | + to="sentry.project", |
| 82 | + ), |
| 83 | + ), |
| 84 | + ], |
| 85 | + options={ |
| 86 | + "db_table": "explore_traceitemattributevaluecontext", |
| 87 | + "indexes": [ |
| 88 | + models.Index( |
| 89 | + fields=[ |
| 90 | + "organization", |
| 91 | + "item_type", |
| 92 | + "attribute_name", |
| 93 | + "attribute_value", |
| 94 | + ], |
| 95 | + name="explore_tra_organiz_a8eb06_idx", |
| 96 | + ) |
| 97 | + ], |
| 98 | + "constraints": [ |
| 99 | + models.UniqueConstraint( |
| 100 | + condition=models.Q(("project__isnull", False)), |
| 101 | + fields=( |
| 102 | + "organization", |
| 103 | + "project", |
| 104 | + "item_type", |
| 105 | + "attribute_name", |
| 106 | + "attribute_value", |
| 107 | + "attribute_type", |
| 108 | + ), |
| 109 | + name="explore_traceitemvalue_unique_project_scoped", |
| 110 | + ), |
| 111 | + models.UniqueConstraint( |
| 112 | + condition=models.Q(("project__isnull", True)), |
| 113 | + fields=( |
| 114 | + "organization", |
| 115 | + "item_type", |
| 116 | + "attribute_name", |
| 117 | + "attribute_value", |
| 118 | + "attribute_type", |
| 119 | + ), |
| 120 | + name="explore_traceitemvalue_unique_org_scoped", |
| 121 | + ), |
| 122 | + ], |
| 123 | + }, |
| 124 | + ), |
| 125 | + ] |
0 commit comments