0014_auto_20240318_1449.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Generated by Django 5.0.3 on 2024-03-18 14:49
  2. import django.db.models.deletion
  3. import psqlextra.backend.migrations.operations.add_default_partition
  4. import psqlextra.backend.migrations.operations.create_partitioned_model
  5. import psqlextra.manager.manager
  6. import psqlextra.models.partitioned
  7. import psqlextra.types
  8. from django.db import migrations, models
  9. from glitchtip.model_utils import TestDefaultPartition
  10. class Migration(migrations.Migration):
  11. dependencies = [
  12. ("projects", "0013_merge_20231017_1350"),
  13. ]
  14. operations = [
  15. psqlextra.backend.migrations.operations.create_partitioned_model.PostgresCreatePartitionedModel(
  16. name="IssueEventProjectHourlyStatistic",
  17. fields=[
  18. (
  19. "id",
  20. models.BigAutoField(
  21. auto_created=True,
  22. primary_key=True,
  23. serialize=False,
  24. verbose_name="ID",
  25. ),
  26. ),
  27. ("date", models.DateTimeField()),
  28. ("count", models.PositiveIntegerField()),
  29. (
  30. "project",
  31. models.ForeignKey(
  32. on_delete=django.db.models.deletion.CASCADE,
  33. to="projects.project",
  34. ),
  35. ),
  36. ],
  37. options={
  38. "abstract": False,
  39. "unique_together": {("project", "date")},
  40. },
  41. partitioning_options={
  42. "method": psqlextra.types.PostgresPartitioningMethod["RANGE"],
  43. "key": ["date"],
  44. },
  45. bases=(psqlextra.models.partitioned.PostgresPartitionedModel,),
  46. managers=[
  47. ("objects", psqlextra.manager.manager.PostgresManager()),
  48. ],
  49. ),
  50. migrations.AlterModelManagers(
  51. name="transactioneventprojecthourlystatistic",
  52. managers=[
  53. ("objects", psqlextra.manager.manager.PostgresManager()),
  54. ],
  55. ),
  56. TestDefaultPartition(
  57. model_name="IssueEventProjectHourlyStatistic",
  58. name="default",
  59. ),
  60. migrations.DeleteModel(
  61. name="EventProjectHourlyStatistic",
  62. ),
  63. migrations.DeleteModel(
  64. name="TransactionEventProjectHourlyStatistic",
  65. ),
  66. psqlextra.backend.migrations.operations.create_partitioned_model.PostgresCreatePartitionedModel(
  67. name="TransactionEventProjectHourlyStatistic",
  68. fields=[
  69. (
  70. "id",
  71. models.BigAutoField(
  72. auto_created=True,
  73. primary_key=True,
  74. serialize=False,
  75. verbose_name="ID",
  76. ),
  77. ),
  78. ("date", models.DateTimeField()),
  79. ("count", models.PositiveIntegerField()),
  80. (
  81. "project",
  82. models.ForeignKey(
  83. on_delete=django.db.models.deletion.CASCADE,
  84. to="projects.project",
  85. ),
  86. ),
  87. ],
  88. options={
  89. "abstract": False,
  90. "unique_together": {("project", "date")},
  91. },
  92. partitioning_options={
  93. "method": psqlextra.types.PostgresPartitioningMethod["RANGE"],
  94. "key": ["date"],
  95. },
  96. bases=(psqlextra.models.partitioned.PostgresPartitionedModel,),
  97. managers=[
  98. ("objects", psqlextra.manager.manager.PostgresManager()),
  99. ],
  100. ),
  101. TestDefaultPartition(
  102. model_name="TransactionEventProjectHourlyStatistic",
  103. name="default",
  104. ),
  105. ]