# Generated by Django 3.2.5 on 2022-05-31 14:46

from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
import django_migration_linter as linter


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('user_management', '0001_squashed_initial'),
        ('alerts', '0001_squashed_initial'),
        ('slack', '0002_squashed_initial'),
        ('telegram', '0001_squashed_initial'),
        ('schedules', '0001_squashed_initial'),
    ]

    operations = [
        linter.IgnoreMigration(),
        migrations.AddField(
            model_name='userhasnotification',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user_management.user'),
        ),
        migrations.AddField(
            model_name='resolutionnoteslackmessage',
            name='added_by_user',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='added_resolution_note_slack_messages', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='resolutionnoteslackmessage',
            name='alert_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='resolution_note_slack_messages', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='resolutionnoteslackmessage',
            name='user',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='authored_resolution_note_slack_messages', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='resolutionnote',
            name='alert_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='resolution_notes', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='resolutionnote',
            name='author',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='authored_resolution_notes', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='resolutionnote',
            name='resolution_note_slack_message',
            field=models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='resolution_note', to='alerts.resolutionnoteslackmessage'),
        ),
        migrations.AddField(
            model_name='invitation',
            name='alert_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invitations', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='invitation',
            name='author',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='author_of_invitations', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='invitation',
            name='invitee',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='invitee_in_invitations', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='grafanaalertingcontactpoint',
            name='alert_receive_channel',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='contact_points', to='alerts.alertreceivechannel'),
        ),
        migrations.AddField(
            model_name='escalationpolicy',
            name='custom_button_trigger',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='escalation_policies', to='alerts.custombutton'),
        ),
        migrations.AddField(
            model_name='escalationpolicy',
            name='escalation_chain',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='escalation_policies', to='alerts.escalationchain'),
        ),
        migrations.AddField(
            model_name='escalationpolicy',
            name='last_notified_user',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='last_notified_in_escalation_policies', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='escalationpolicy',
            name='notify_schedule',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='escalation_policies', to='schedules.oncallschedule'),
        ),
        migrations.AddField(
            model_name='escalationpolicy',
            name='notify_to_group',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='slack.slackusergroup'),
        ),
        migrations.AddField(
            model_name='escalationpolicy',
            name='notify_to_users_queue',
            field=models.ManyToManyField(to='user_management.User'),
        ),
        migrations.AddField(
            model_name='escalationchain',
            name='organization',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='escalation_chains', to='user_management.organization'),
        ),
        migrations.AddField(
            model_name='escalationchain',
            name='team',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='escalation_chains', to='user_management.team'),
        ),
        migrations.AddField(
            model_name='custombutton',
            name='organization',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='custom_buttons', to='user_management.organization'),
        ),
        migrations.AddField(
            model_name='custombutton',
            name='team',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='custom_buttons', to='user_management.team'),
        ),
        migrations.AddField(
            model_name='channelfilter',
            name='alert_receive_channel',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channel_filters', to='alerts.alertreceivechannel'),
        ),
        migrations.AddField(
            model_name='channelfilter',
            name='escalation_chain',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='channel_filters', to='alerts.escalationchain'),
        ),
        migrations.AddField(
            model_name='channelfilter',
            name='telegram_channel',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='channel_filter', to='telegram.telegramtoorganizationconnector'),
        ),
        migrations.AddField(
            model_name='alertreceivechannel',
            name='author',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='alert_receive_channels', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='alertreceivechannel',
            name='maintenance_author',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='alertreceivechannel_maintenances_created', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='alertreceivechannel',
            name='organization',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='alert_receive_channels', to='user_management.organization'),
        ),
        migrations.AddField(
            model_name='alertreceivechannel',
            name='team',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='alert_receive_channels', to='user_management.team'),
        ),
        migrations.AddField(
            model_name='alertgrouppostmortem',
            name='alert_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='postmortem_text', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='alertgrouplogrecord',
            name='alert_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='log_records', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='alertgrouplogrecord',
            name='author',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='log_records', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='alertgrouplogrecord',
            name='custom_button',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, related_name='log_records', to='alerts.custombutton'),
        ),
        migrations.AddField(
            model_name='alertgrouplogrecord',
            name='dependent_alert_group',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dependent_log_records', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='alertgrouplogrecord',
            name='escalation_policy',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='log_records', to='alerts.escalationpolicy'),
        ),
        migrations.AddField(
            model_name='alertgrouplogrecord',
            name='invitation',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='log_records', to='alerts.invitation'),
        ),
        migrations.AddField(
            model_name='alertgrouplogrecord',
            name='root_alert_group',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='root_log_records', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='alertgroupcounter',
            name='organization',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='user_management.organization'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='acknowledged_by_user',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='user_management.user'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='channel',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='alert_groups', to='alerts.alertreceivechannel'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='channel_filter',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, related_name='alert_groups', to='alerts.channelfilter'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='resolved_by_alert',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='resolved_alert_groups', to='alerts.alert'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='resolved_by_user',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='resolved_alert_groups', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='root_alert_group',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dependent_alert_groups', to='alerts.alertgroup'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='silenced_by_user',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='silenced_alert_groups', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='slack_log_message',
            field=models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='slack.slackmessage'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='slack_message',
            field=models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='_alert_group', to='slack.slackmessage'),
        ),
        migrations.AddField(
            model_name='alertgroup',
            name='wiped_by',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='wiped_by_user', to='user_management.user'),
        ),
        migrations.AddField(
            model_name='alert',
            name='group',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='alerts', to='alerts.alertgroup'),
        ),
        migrations.CreateModel(
            name='AlertForAlertManager',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('alerts.alert',),
        ),
        migrations.CreateModel(
            name='AlertGroupForAlertManager',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('alerts.alertgroup',),
            managers=[
                ('all_objects', django.db.models.manager.Manager()),
            ],
        ),
        migrations.AlterUniqueTogether(
            name='userhasnotification',
            unique_together={('user', 'alert_group')},
        ),
        migrations.AlterUniqueTogether(
            name='resolutionnoteslackmessage',
            unique_together={('thread_ts', 'ts')},
        ),
        migrations.AlterUniqueTogether(
            name='escalationchain',
            unique_together={('organization', 'name')},
        ),
        migrations.AlterUniqueTogether(
            name='custombutton',
            unique_together={('name', 'organization')},
        ),
        migrations.AddConstraint(
            model_name='alertreceivechannel',
            constraint=models.UniqueConstraint(fields=('organization', 'verbal_name', 'deleted_at'), name='unique integration name'),
        ),
        migrations.AlterUniqueTogether(
            name='alertgroup',
            unique_together={('channel_id', 'channel_filter_id', 'distinction', 'is_open_for_grouping')},
        ),
    ]
