0001_squashed_0003_auto_20210116_2110.py 5.2 KB

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