123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- # Generated by Django 3.2.5 on 2021-08-04 17:27
- import datetime
- import django.db.models.deletion
- from django.db import migrations, models
- class Migration(migrations.Migration):
- initial = True
- dependencies = [
- (
- "organizations_ext",
- "0001_squashed_0009_organization_scrub_ip_addresses",
- ),
- ("environments", "0002_auto_20201229_1643"),
- ("projects", "0008_alter_projectkey_created"),
- ]
- operations = [
- migrations.CreateModel(
- name="Monitor",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
- (
- "monitor_type",
- models.CharField(
- choices=[
- ("ping", "Ping"),
- ("get", "GET"),
- ("post", "POST"),
- ("ssl", "SSL"),
- ("heartbeat", "Heartbeat"),
- ],
- default="ping",
- max_length=12,
- ),
- ),
- ("name", models.CharField(max_length=200)),
- ("url", models.URLField(blank=True)),
- ("expected_status", models.PositiveSmallIntegerField(default=200)),
- ("expected_body", models.CharField(blank=True, max_length=2000)),
- ("ip_address", models.GenericIPAddressField(blank=True, null=True)),
- (
- "interval",
- models.DurationField(default=datetime.timedelta(seconds=60)),
- ),
- (
- "environment",
- models.ForeignKey(
- blank=True,
- null=True,
- on_delete=django.db.models.deletion.SET_NULL,
- to="environments.environment",
- ),
- ),
- (
- "organization",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to="organizations_ext.organization",
- ),
- ),
- (
- "project",
- models.ForeignKey(
- blank=True,
- null=True,
- on_delete=django.db.models.deletion.SET_NULL,
- to="projects.project",
- ),
- ),
- ],
- options={
- "abstract": False,
- },
- ),
- migrations.CreateModel(
- name="MonitorCheck",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
- ("is_up", models.BooleanField()),
- (
- "start_check",
- models.DateTimeField(
- help_text="Time when the start of this check was performed"
- ),
- ),
- (
- "reason",
- models.PositiveSmallIntegerField(
- blank=True,
- choices=[
- (0, "Unknown"),
- (1, "Timeout"),
- (2, "Wrong status code"),
- (3, "Expected response not found"),
- (4, "SSL Error"),
- ],
- default=0,
- null=True,
- ),
- ),
- ("response_time", models.DurationField(blank=True, null=True)),
- ("data", models.JSONField(blank=True, null=True)),
- (
- "monitor",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- related_name="checks",
- to="uptime.monitor",
- ),
- ),
- ],
- options={
- "ordering": ("-created",),
- },
- ),
- migrations.AddIndex(
- model_name="monitorcheck",
- index=models.Index(
- fields=["start_check", "monitor"], name="uptime_moni_start_c_6434f7_idx"
- ),
- ),
- ]
|