0001_squashed_0012_alter_span_op.py 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. # Generated by Django 5.0.3 on 2024-03-15 14:08
  2. import datetime
  3. import django.contrib.postgres.fields.hstore
  4. import django.contrib.postgres.search
  5. import django.db.models.deletion
  6. import uuid
  7. from django.db import migrations, models
  8. # Functions from the following migrations need manual copying.
  9. # Move them and any dependencies into this file, then update the
  10. # RunPython operations to refer to the local versions:
  11. # apps.performance.migrations.0004_remove_transactionevent_project_and_more
  12. # apps.performance.migrations.0008_transactionevent_duration
  13. class Migration(migrations.Migration):
  14. initial = True
  15. dependencies = [
  16. (
  17. "projects",
  18. "0001_squashed_0009_alter_project_id_alter_projectcounter_id_and_more",
  19. ),
  20. ]
  21. operations = [
  22. migrations.CreateModel(
  23. name="TransactionEvent",
  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. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  35. (
  36. "data",
  37. models.JSONField(help_text="General event data that is searchable"),
  38. ),
  39. (
  40. "timestamp",
  41. models.DateTimeField(
  42. blank=True,
  43. help_text="Date created as claimed by client it came from",
  44. null=True,
  45. ),
  46. ),
  47. ("transaction", models.CharField(max_length=1024)),
  48. ("start_timestamp", models.DateTimeField()),
  49. (
  50. "project",
  51. models.ForeignKey(
  52. on_delete=django.db.models.deletion.CASCADE,
  53. to="projects.project",
  54. ),
  55. ),
  56. ],
  57. options={
  58. "ordering": ["-created"],
  59. },
  60. ),
  61. migrations.RemoveField(
  62. model_name="transactionevent",
  63. name="project",
  64. ),
  65. migrations.AddField(
  66. model_name="transactionevent",
  67. name="trace_id",
  68. field=models.UUIDField(
  69. db_index=True, default="00000000000000000000000000000000"
  70. ),
  71. preserve_default=False,
  72. ),
  73. migrations.CreateModel(
  74. name="TransactionGroup",
  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. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  86. ("transaction", models.CharField(max_length=1024)),
  87. ("op", models.CharField(max_length=255)),
  88. ("method", models.CharField(blank=True, max_length=255, null=True)),
  89. (
  90. "project",
  91. models.ForeignKey(
  92. on_delete=django.db.models.deletion.CASCADE,
  93. to="projects.project",
  94. ),
  95. ),
  96. (
  97. "search_vector",
  98. django.contrib.postgres.search.SearchVectorField(
  99. editable=False, null=True
  100. ),
  101. ),
  102. ("tags", models.JSONField(default=dict)),
  103. ],
  104. options={
  105. "unique_together": {("transaction", "project", "op", "method")},
  106. },
  107. ),
  108. migrations.AddField(
  109. model_name="transactionevent",
  110. name="group",
  111. field=models.ForeignKey(
  112. default=1,
  113. on_delete=django.db.models.deletion.CASCADE,
  114. to="performance.transactiongroup",
  115. ),
  116. preserve_default=False,
  117. ),
  118. migrations.CreateModel(
  119. name="Span",
  120. fields=[
  121. (
  122. "id",
  123. models.AutoField(
  124. auto_created=True,
  125. primary_key=True,
  126. serialize=False,
  127. verbose_name="ID",
  128. ),
  129. ),
  130. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  131. ("span_id", models.CharField(max_length=16)),
  132. (
  133. "parent_span_id",
  134. models.CharField(blank=True, max_length=16, null=True),
  135. ),
  136. ("op", models.CharField(max_length=255)),
  137. (
  138. "description",
  139. models.CharField(blank=True, max_length=1024, null=True),
  140. ),
  141. ("start_timestamp", models.DateTimeField()),
  142. ("timestamp", models.DateTimeField()),
  143. (
  144. "tags",
  145. django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  146. ),
  147. ("data", models.JSONField(default=dict)),
  148. (
  149. "transaction",
  150. models.ForeignKey(
  151. on_delete=django.db.models.deletion.CASCADE,
  152. to="performance.transactionevent",
  153. ),
  154. ),
  155. ],
  156. options={
  157. "abstract": False,
  158. },
  159. ),
  160. migrations.RemoveField(
  161. model_name="transactionevent",
  162. name="transaction",
  163. ),
  164. migrations.AddField(
  165. model_name="transactionevent",
  166. name="tags",
  167. field=django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  168. ),
  169. migrations.AddField(
  170. model_name="transactionevent",
  171. name="duration",
  172. field=models.DurationField(db_index=True, default=datetime.timedelta(0)),
  173. preserve_default=False,
  174. ),
  175. migrations.AlterField(
  176. model_name="span",
  177. name="description",
  178. field=models.CharField(blank=True, max_length=2000, null=True),
  179. ),
  180. migrations.AlterField(
  181. model_name="span",
  182. name="id",
  183. field=models.BigAutoField(
  184. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  185. ),
  186. ),
  187. migrations.AlterField(
  188. model_name="transactiongroup",
  189. name="id",
  190. field=models.BigAutoField(
  191. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  192. ),
  193. ),
  194. migrations.RemoveField(
  195. model_name="transactionevent",
  196. name="duration",
  197. ),
  198. migrations.AddField(
  199. model_name="transactionevent",
  200. name="duration",
  201. field=models.PositiveIntegerField(
  202. db_index=True, default=0, help_text="Milliseconds"
  203. ),
  204. preserve_default=False,
  205. ),
  206. migrations.AlterField(
  207. model_name="span",
  208. name="op",
  209. field=models.CharField(blank=True, max_length=255),
  210. ),
  211. ]