123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- # Generated by Django 5.0.3 on 2024-03-15 14:05
- import django.db.models.deletion
- from django.db import migrations, models
- class Migration(migrations.Migration):
- replaces = [
- (
- "alerts",
- "0001_squashed_0007_alter_alertrecipient_id_alter_notification_id_and_more",
- ),
- ("alerts", "0008_alter_alertrecipient_recipient_type"),
- ("alerts", "0009_alter_alertrecipient_recipient_type"),
- ("alerts", "0010_alter_notification_issues"),
- ]
- initial = True
- dependencies = [
- ("issue_events", "0001_initial"),
- (
- "projects",
- "0001_squashed_0009_alter_project_id_alter_projectcounter_id_and_more",
- ),
- ]
- operations = [
- migrations.CreateModel(
- name="ProjectAlert",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- (
- "timespan_minutes",
- models.PositiveSmallIntegerField(blank=True, null=True),
- ),
- ("quantity", models.PositiveSmallIntegerField(blank=True, null=True)),
- ("created", models.DateTimeField(auto_now_add=True, db_index=True)),
- (
- "project",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to="projects.project",
- ),
- ),
- ("name", models.CharField(blank=True, max_length=255)),
- (
- "uptime",
- models.BooleanField(
- default=False,
- help_text="Send alert on any uptime monitor check failure",
- ),
- ),
- ],
- ),
- migrations.CreateModel(
- name="AlertRecipient",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- (
- "recipient_type",
- models.CharField(
- choices=[
- ("email", "Email"),
- ("webhook", "General Slack-compatible webhook"),
- ("discord", "Discord"),
- ("googlechat", "Google Chat webhook"),
- ],
- max_length=16,
- ),
- ),
- ("url", models.URLField(blank=True, max_length=2000)),
- (
- "alert",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to="alerts.projectalert",
- ),
- ),
- ],
- options={
- "unique_together": {("alert", "recipient_type", "url")},
- },
- ),
- migrations.CreateModel(
- name="Notification",
- 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_sent", models.BooleanField(default=False)),
- ("issues", models.ManyToManyField(to="issue_events.issue")),
- (
- "project_alert",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to="alerts.projectalert",
- ),
- ),
- ],
- ),
- ]
|