0001_initial.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Generated by Django 3.2.5 on 2021-08-04 17:27
  2. import datetime
  3. import django.db.models.deletion
  4. from django.db import migrations, models
  5. class Migration(migrations.Migration):
  6. initial = True
  7. dependencies = [
  8. (
  9. "organizations_ext",
  10. "0001_squashed_0009_organization_scrub_ip_addresses",
  11. ),
  12. ("environments", "0002_auto_20201229_1643"),
  13. ("projects", "0008_alter_projectkey_created"),
  14. ]
  15. operations = [
  16. migrations.CreateModel(
  17. name="Monitor",
  18. fields=[
  19. (
  20. "id",
  21. models.BigAutoField(
  22. auto_created=True,
  23. primary_key=True,
  24. serialize=False,
  25. verbose_name="ID",
  26. ),
  27. ),
  28. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  29. (
  30. "monitor_type",
  31. models.CharField(
  32. choices=[
  33. ("ping", "Ping"),
  34. ("get", "GET"),
  35. ("post", "POST"),
  36. ("ssl", "SSL"),
  37. ("heartbeat", "Heartbeat"),
  38. ],
  39. default="ping",
  40. max_length=12,
  41. ),
  42. ),
  43. ("name", models.CharField(max_length=200)),
  44. ("url", models.URLField(blank=True)),
  45. ("expected_status", models.PositiveSmallIntegerField(default=200)),
  46. ("expected_body", models.CharField(blank=True, max_length=2000)),
  47. ("ip_address", models.GenericIPAddressField(blank=True, null=True)),
  48. (
  49. "interval",
  50. models.DurationField(default=datetime.timedelta(seconds=60)),
  51. ),
  52. (
  53. "environment",
  54. models.ForeignKey(
  55. blank=True,
  56. null=True,
  57. on_delete=django.db.models.deletion.SET_NULL,
  58. to="environments.environment",
  59. ),
  60. ),
  61. (
  62. "organization",
  63. models.ForeignKey(
  64. on_delete=django.db.models.deletion.CASCADE,
  65. to="organizations_ext.organization",
  66. ),
  67. ),
  68. (
  69. "project",
  70. models.ForeignKey(
  71. blank=True,
  72. null=True,
  73. on_delete=django.db.models.deletion.SET_NULL,
  74. to="projects.project",
  75. ),
  76. ),
  77. ],
  78. options={
  79. "abstract": False,
  80. },
  81. ),
  82. migrations.CreateModel(
  83. name="MonitorCheck",
  84. fields=[
  85. (
  86. "id",
  87. models.BigAutoField(
  88. auto_created=True,
  89. primary_key=True,
  90. serialize=False,
  91. verbose_name="ID",
  92. ),
  93. ),
  94. ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
  95. ("is_up", models.BooleanField()),
  96. (
  97. "start_check",
  98. models.DateTimeField(
  99. help_text="Time when the start of this check was performed"
  100. ),
  101. ),
  102. (
  103. "reason",
  104. models.PositiveSmallIntegerField(
  105. blank=True,
  106. choices=[
  107. (0, "Unknown"),
  108. (1, "Timeout"),
  109. (2, "Wrong status code"),
  110. (3, "Expected response not found"),
  111. (4, "SSL Error"),
  112. ],
  113. default=0,
  114. null=True,
  115. ),
  116. ),
  117. ("response_time", models.DurationField(blank=True, null=True)),
  118. ("data", models.JSONField(blank=True, null=True)),
  119. (
  120. "monitor",
  121. models.ForeignKey(
  122. on_delete=django.db.models.deletion.CASCADE,
  123. related_name="checks",
  124. to="uptime.monitor",
  125. ),
  126. ),
  127. ],
  128. options={
  129. "ordering": ("-created",),
  130. },
  131. ),
  132. migrations.AddIndex(
  133. model_name="monitorcheck",
  134. index=models.Index(
  135. fields=["start_check", "monitor"], name="uptime_moni_start_c_6434f7_idx"
  136. ),
  137. ),
  138. ]