0001_squashed_0012_alter_span_op.py 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. replaces = [
  15. ("performance", "0001_initial"),
  16. ("performance", "0002_auto_20210124_1745"),
  17. ("performance", "0003_transactionevent"),
  18. ("performance", "0004_remove_transactionevent_project_and_more"),
  19. ("performance", "0005_alter_span_data"),
  20. ("performance", "0006_rename_title_transactiongroup_transaction_and_more"),
  21. (
  22. "performance",
  23. "0007_transactionevent_tags_transactiongroup_search_vector_and_more",
  24. ),
  25. ("performance", "0008_transactionevent_duration"),
  26. ("performance", "0009_alter_span_description"),
  27. ("performance", "0010_alter_span_id_alter_transactiongroup_id"),
  28. ("performance", "0011_alter_transactionevent_duration"),
  29. ("performance", "0012_alter_span_op"),
  30. ]
  31. initial = True
  32. dependencies = [
  33. (
  34. "projects",
  35. "0001_squashed_0009_alter_project_id_alter_projectcounter_id_and_more",
  36. ),
  37. ]
  38. operations = [
  39. migrations.CreateModel(
  40. name="TransactionEvent",
  41. fields=[
  42. (
  43. "event_id",
  44. models.UUIDField(
  45. default=uuid.uuid4,
  46. editable=False,
  47. primary_key=True,
  48. serialize=False,
  49. ),
  50. ),
  51. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  52. (
  53. "data",
  54. models.JSONField(help_text="General event data that is searchable"),
  55. ),
  56. (
  57. "timestamp",
  58. models.DateTimeField(
  59. blank=True,
  60. help_text="Date created as claimed by client it came from",
  61. null=True,
  62. ),
  63. ),
  64. ("transaction", models.CharField(max_length=1024)),
  65. ("start_timestamp", models.DateTimeField()),
  66. (
  67. "project",
  68. models.ForeignKey(
  69. on_delete=django.db.models.deletion.CASCADE,
  70. to="projects.project",
  71. ),
  72. ),
  73. ],
  74. options={
  75. "ordering": ["-created"],
  76. },
  77. ),
  78. migrations.RemoveField(
  79. model_name="transactionevent",
  80. name="project",
  81. ),
  82. migrations.AddField(
  83. model_name="transactionevent",
  84. name="trace_id",
  85. field=models.UUIDField(
  86. db_index=True, default="00000000000000000000000000000000"
  87. ),
  88. preserve_default=False,
  89. ),
  90. migrations.CreateModel(
  91. name="TransactionGroup",
  92. fields=[
  93. (
  94. "id",
  95. models.AutoField(
  96. auto_created=True,
  97. primary_key=True,
  98. serialize=False,
  99. verbose_name="ID",
  100. ),
  101. ),
  102. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  103. ("transaction", models.CharField(max_length=1024)),
  104. ("op", models.CharField(max_length=255)),
  105. ("method", models.CharField(blank=True, max_length=255, null=True)),
  106. (
  107. "project",
  108. models.ForeignKey(
  109. on_delete=django.db.models.deletion.CASCADE,
  110. to="projects.project",
  111. ),
  112. ),
  113. (
  114. "search_vector",
  115. django.contrib.postgres.search.SearchVectorField(
  116. editable=False, null=True
  117. ),
  118. ),
  119. ("tags", models.JSONField(default=dict)),
  120. ],
  121. options={
  122. "unique_together": {("transaction", "project", "op", "method")},
  123. },
  124. ),
  125. migrations.AddField(
  126. model_name="transactionevent",
  127. name="group",
  128. field=models.ForeignKey(
  129. default=1,
  130. on_delete=django.db.models.deletion.CASCADE,
  131. to="performance.transactiongroup",
  132. ),
  133. preserve_default=False,
  134. ),
  135. migrations.CreateModel(
  136. name="Span",
  137. fields=[
  138. (
  139. "id",
  140. models.AutoField(
  141. auto_created=True,
  142. primary_key=True,
  143. serialize=False,
  144. verbose_name="ID",
  145. ),
  146. ),
  147. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  148. ("span_id", models.CharField(max_length=16)),
  149. (
  150. "parent_span_id",
  151. models.CharField(blank=True, max_length=16, null=True),
  152. ),
  153. ("op", models.CharField(max_length=255)),
  154. (
  155. "description",
  156. models.CharField(blank=True, max_length=1024, null=True),
  157. ),
  158. ("start_timestamp", models.DateTimeField()),
  159. ("timestamp", models.DateTimeField()),
  160. (
  161. "tags",
  162. django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  163. ),
  164. ("data", models.JSONField(default=dict)),
  165. (
  166. "transaction",
  167. models.ForeignKey(
  168. on_delete=django.db.models.deletion.CASCADE,
  169. to="performance.transactionevent",
  170. ),
  171. ),
  172. ],
  173. options={
  174. "abstract": False,
  175. },
  176. ),
  177. migrations.RemoveField(
  178. model_name="transactionevent",
  179. name="transaction",
  180. ),
  181. migrations.AddField(
  182. model_name="transactionevent",
  183. name="tags",
  184. field=django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  185. ),
  186. migrations.AddField(
  187. model_name="transactionevent",
  188. name="duration",
  189. field=models.DurationField(db_index=True, default=datetime.timedelta(0)),
  190. preserve_default=False,
  191. ),
  192. migrations.AlterField(
  193. model_name="span",
  194. name="description",
  195. field=models.CharField(blank=True, max_length=2000, null=True),
  196. ),
  197. migrations.AlterField(
  198. model_name="span",
  199. name="id",
  200. field=models.BigAutoField(
  201. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  202. ),
  203. ),
  204. migrations.AlterField(
  205. model_name="transactiongroup",
  206. name="id",
  207. field=models.BigAutoField(
  208. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  209. ),
  210. ),
  211. migrations.RemoveField(
  212. model_name="transactionevent",
  213. name="duration",
  214. ),
  215. migrations.AddField(
  216. model_name="transactionevent",
  217. name="duration",
  218. field=models.PositiveIntegerField(
  219. db_index=True, default=0, help_text="Milliseconds"
  220. ),
  221. preserve_default=False,
  222. ),
  223. migrations.AlterField(
  224. model_name="span",
  225. name="op",
  226. field=models.CharField(blank=True, max_length=255),
  227. ),
  228. ]