0001_squashed_0003_auto_20210219_1951.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. # Generated by Django 4.1.3 on 2022-12-10 15:28
  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. class Migration(migrations.Migration):
  8. replaces = [
  9. ("events", "0001_squashed_0003_auto_20210116_2110"),
  10. ("events", "0002_auto_20210122_1836"),
  11. ("events", "0003_auto_20210219_1951"),
  12. ]
  13. initial = True
  14. dependencies = [
  15. ("issues", "0002_auto_20210219_1931"),
  16. ("releases", "0002_auto_20201227_1518"),
  17. ("issues", "0001_squashed_0010_auto_20210117_1543"),
  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={
  70. "ordering": ["-created"],
  71. },
  72. ),
  73. migrations.CreateModel(
  74. name="EventTagKey",
  75. fields=[
  76. (
  77. "id",
  78. models.AutoField(
  79. auto_created=True,
  80. primary_key=True,
  81. serialize=False,
  82. verbose_name="ID",
  83. ),
  84. ),
  85. ("key", models.CharField(max_length=255, unique=True)),
  86. ],
  87. ),
  88. migrations.CreateModel(
  89. name="EventTag",
  90. fields=[
  91. (
  92. "id",
  93. models.AutoField(
  94. auto_created=True,
  95. primary_key=True,
  96. serialize=False,
  97. verbose_name="ID",
  98. ),
  99. ),
  100. ("value", models.CharField(max_length=225)),
  101. (
  102. "key",
  103. models.ForeignKey(
  104. on_delete=django.db.models.deletion.CASCADE,
  105. to="events.eventtagkey",
  106. ),
  107. ),
  108. ],
  109. options={
  110. "unique_together": {("key", "value")},
  111. },
  112. ),
  113. ],
  114. ),
  115. migrations.RunSQL(
  116. sql="\nDROP TRIGGER IF EXISTS event_issue_update on events_event;\n",
  117. reverse_sql="DROP TRIGGER IF EXISTS event_issue_update on issues_event; DROP FUNCTION IF EXISTS update_issue;",
  118. ),
  119. migrations.AlterField(
  120. model_name="event",
  121. name="issue",
  122. field=models.ForeignKey(
  123. help_text="Sentry calls this a group",
  124. null=True,
  125. on_delete=django.db.models.deletion.CASCADE,
  126. to="issues.issue",
  127. ),
  128. ),
  129. migrations.RemoveField(
  130. model_name="event",
  131. name="tags",
  132. ),
  133. django.contrib.postgres.operations.HStoreExtension(),
  134. migrations.AddField(
  135. model_name="event",
  136. name="tags",
  137. field=django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  138. ),
  139. migrations.DeleteModel(
  140. name="EventTag",
  141. ),
  142. migrations.DeleteModel(
  143. name="EventTagKey",
  144. ),
  145. migrations.AddField(
  146. model_name="event",
  147. name="errors",
  148. field=models.JSONField(
  149. blank=True,
  150. help_text="Event processing errors from event intake, including validation errors",
  151. null=True,
  152. ),
  153. ),
  154. migrations.AlterField(
  155. model_name="event",
  156. name="data",
  157. field=models.JSONField(help_text="General event data that is searchable"),
  158. ),
  159. migrations.AddField(
  160. model_name="event",
  161. name="level",
  162. field=models.PositiveSmallIntegerField(
  163. choices=[
  164. (0, "sample"),
  165. (1, "debug"),
  166. (2, "info"),
  167. (3, "warning"),
  168. (4, "error"),
  169. (5, "fatal"),
  170. ],
  171. default=4,
  172. ),
  173. ),
  174. migrations.AlterField(
  175. model_name="event",
  176. name="issue",
  177. field=models.ForeignKey(
  178. default=1,
  179. help_text="Sentry calls this a group",
  180. on_delete=django.db.models.deletion.CASCADE,
  181. to="issues.issue",
  182. ),
  183. preserve_default=False,
  184. ),
  185. ]