0001_squashed_0003_auto_20210116_2110.py 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # Generated by Django 3.1.5 on 2021-01-17 17:07
  2. import django.contrib.postgres.fields.hstore
  3. import django.contrib.postgres.operations
  4. from django.db import migrations, models
  5. import django.db.models.deletion
  6. import uuid
  7. from issues.migrations.sql.triggers import UPDATE_ISSUE_TRIGGER
  8. class Migration(migrations.Migration):
  9. initial = True
  10. dependencies = [
  11. ("issues", "0001_squashed_0010_auto_20210117_1543"),
  12. ("releases", "0002_auto_20201227_1518"),
  13. ]
  14. operations = [
  15. migrations.SeparateDatabaseAndState(
  16. state_operations=[
  17. migrations.CreateModel(
  18. name="Event",
  19. fields=[
  20. (
  21. "event_id",
  22. models.UUIDField(
  23. default=uuid.uuid4,
  24. editable=False,
  25. primary_key=True,
  26. serialize=False,
  27. ),
  28. ),
  29. (
  30. "timestamp",
  31. models.DateTimeField(
  32. blank=True,
  33. help_text="Date created as claimed by client it came from",
  34. null=True,
  35. ),
  36. ),
  37. (
  38. "created",
  39. models.DateTimeField(auto_now_add=True, db_index=True),
  40. ),
  41. ("data", models.JSONField()),
  42. (
  43. "issue",
  44. models.ForeignKey(
  45. help_text="Sentry calls this a group",
  46. on_delete=django.db.models.deletion.CASCADE,
  47. to="issues.issue",
  48. ),
  49. ),
  50. (
  51. "release",
  52. models.ForeignKey(
  53. blank=True,
  54. null=True,
  55. on_delete=django.db.models.deletion.SET_NULL,
  56. to="releases.release",
  57. ),
  58. ),
  59. (
  60. "tags",
  61. models.ManyToManyField(blank=True, to="events.EventTag"),
  62. ),
  63. ],
  64. options={
  65. "ordering": ["-created"],
  66. },
  67. ),
  68. migrations.CreateModel(
  69. name="EventTagKey",
  70. fields=[
  71. (
  72. "id",
  73. models.AutoField(
  74. auto_created=True,
  75. primary_key=True,
  76. serialize=False,
  77. verbose_name="ID",
  78. ),
  79. ),
  80. ("key", models.CharField(max_length=255, unique=True)),
  81. ],
  82. ),
  83. migrations.CreateModel(
  84. name="EventTag",
  85. fields=[
  86. (
  87. "id",
  88. models.AutoField(
  89. auto_created=True,
  90. primary_key=True,
  91. serialize=False,
  92. verbose_name="ID",
  93. ),
  94. ),
  95. ("value", models.CharField(max_length=225)),
  96. (
  97. "key",
  98. models.ForeignKey(
  99. on_delete=django.db.models.deletion.CASCADE,
  100. to="events.eventtagkey",
  101. ),
  102. ),
  103. ],
  104. options={
  105. "unique_together": {("key", "value")},
  106. },
  107. ),
  108. ],
  109. ),
  110. migrations.RunSQL(
  111. sql=UPDATE_ISSUE_TRIGGER,
  112. reverse_sql="DROP TRIGGER IF EXISTS event_issue_update on issues_event; DROP FUNCTION IF EXISTS update_issue;",
  113. ),
  114. migrations.AlterField(
  115. model_name="event",
  116. name="issue",
  117. field=models.ForeignKey(
  118. help_text="Sentry calls this a group",
  119. null=True,
  120. on_delete=django.db.models.deletion.CASCADE,
  121. to="issues.issue",
  122. ),
  123. ),
  124. migrations.RemoveField(
  125. model_name="event",
  126. name="tags",
  127. ),
  128. django.contrib.postgres.operations.HStoreExtension(),
  129. migrations.AddField(
  130. model_name="event",
  131. name="tags",
  132. field=django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  133. ),
  134. migrations.DeleteModel(
  135. name="EventTag",
  136. ),
  137. migrations.DeleteModel(
  138. name="EventTagKey",
  139. ),
  140. ]