0004_remove_transactionevent_project_and_more.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # Generated by Django 4.0.3 on 2022-03-16 23:23
  2. import django.contrib.postgres.fields.hstore
  3. from django.db import migrations, models
  4. import django.db.models.deletion
  5. def forwards_func(apps, schema_editor):
  6. TransactionEvent = apps.get_model("performance", "TransactionEvent")
  7. qs = TransactionEvent.objects.all()
  8. qs._raw_delete(qs.db)
  9. def reverse_func(apps, schema_editor):
  10. pass
  11. class Migration(migrations.Migration):
  12. dependencies = [
  13. ("projects", "0008_alter_projectkey_created"),
  14. ("performance", "0003_transactionevent"),
  15. ]
  16. operations = [
  17. migrations.RunPython(forwards_func, reverse_func),
  18. migrations.RemoveField(
  19. model_name="transactionevent",
  20. name="project",
  21. ),
  22. migrations.AddField(
  23. model_name="transactionevent",
  24. name="trace_id",
  25. field=models.UUIDField(
  26. db_index=True, default="00000000000000000000000000000000"
  27. ),
  28. preserve_default=False,
  29. ),
  30. migrations.CreateModel(
  31. name="TransactionGroup",
  32. fields=[
  33. (
  34. "id",
  35. models.AutoField(
  36. auto_created=True,
  37. primary_key=True,
  38. serialize=False,
  39. verbose_name="ID",
  40. ),
  41. ),
  42. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  43. ("title", models.CharField(max_length=1024)),
  44. ("op", models.CharField(max_length=255)),
  45. ("method", models.CharField(blank=True, max_length=255, null=True)),
  46. (
  47. "project",
  48. models.ForeignKey(
  49. on_delete=django.db.models.deletion.CASCADE,
  50. to="projects.project",
  51. ),
  52. ),
  53. ],
  54. options={
  55. "unique_together": {("title", "project", "op", "method")},
  56. },
  57. ),
  58. migrations.CreateModel(
  59. name="Span",
  60. fields=[
  61. (
  62. "id",
  63. models.AutoField(
  64. auto_created=True,
  65. primary_key=True,
  66. serialize=False,
  67. verbose_name="ID",
  68. ),
  69. ),
  70. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  71. ("span_id", models.CharField(max_length=16)),
  72. (
  73. "parent_span_id",
  74. models.CharField(blank=True, max_length=16, null=True),
  75. ),
  76. ("op", models.CharField(max_length=255)),
  77. (
  78. "description",
  79. models.CharField(blank=True, max_length=1024, null=True),
  80. ),
  81. ("start_timestamp", models.DateTimeField()),
  82. ("timestamp", models.DateTimeField()),
  83. (
  84. "tags",
  85. django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  86. ),
  87. (
  88. "data",
  89. django.contrib.postgres.fields.hstore.HStoreField(default=dict),
  90. ),
  91. (
  92. "transaction",
  93. models.ForeignKey(
  94. on_delete=django.db.models.deletion.CASCADE,
  95. to="performance.transactionevent",
  96. ),
  97. ),
  98. ],
  99. options={
  100. "abstract": False,
  101. },
  102. ),
  103. migrations.AddField(
  104. model_name="transactionevent",
  105. name="group",
  106. field=models.ForeignKey(
  107. default=1,
  108. on_delete=django.db.models.deletion.CASCADE,
  109. to="performance.transactiongroup",
  110. ),
  111. preserve_default=False,
  112. ),
  113. ]