0001_initial.py 4.8 KB

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