# What this PR does This PR adds [django-migration-linter](https://github.com/3YOURMIND/django-migration-linter) to keep database migrations backwards compatible - we can automatically run migrations and they are zero-downtime, e.g. old code can work with the migrated database - we can run and rollback migrations without worrying about data safety - OnCall is deployed to the multiple environments core team is not able to control See [django-migration-linter checklist](https://github.com/3YOURMIND/django-migration-linter/blob/main/docs/incompatibilities.md) for the common mistakes and best practices ## Which issue(s) this PR fixes ## Checklist - [ ] Tests updated - [ ] Documentation added - [ ] `CHANGELOG.md` updated --------- Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
62 lines
4 KiB
Python
62 lines
4 KiB
Python
# 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_migration_linter as linter
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('user_management', '0001_squashed_initial'),
|
|
('base', '0002_squashed_initial'),
|
|
('alerts', '0001_squashed_initial'),
|
|
]
|
|
|
|
operations = [
|
|
linter.IgnoreMigration(),
|
|
migrations.CreateModel(
|
|
name='TwilioLogRecord',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('phone_number', models.CharField(max_length=16)),
|
|
('type', models.PositiveSmallIntegerField(choices=[(10, 'verification start'), (20, 'verification check')], default=10)),
|
|
('status', models.PositiveSmallIntegerField(choices=[(10, 'pending'), (20, 'approved'), (30, 'denied'), (40, 'error')], default=10)),
|
|
('payload', models.TextField(default=None, null=True)),
|
|
('error_message', models.TextField(default=None, null=True)),
|
|
('succeed', models.BooleanField(default=False)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user_management.user')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='SMSMessage',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('exceeded_limit', models.BooleanField(default=None, null=True)),
|
|
('status', models.PositiveSmallIntegerField(blank=True, choices=[(10, 'accepted'), (20, 'queued'), (30, 'sending'), (40, 'sent'), (50, 'failed'), (60, 'delivered'), (70, 'undelivered'), (80, 'receiving'), (90, 'received'), (100, 'read')], null=True)),
|
|
('sid', models.CharField(blank=True, max_length=50)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('notification_policy', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='base.usernotificationpolicy')),
|
|
('receiver', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='user_management.user')),
|
|
('represents_alert', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='alerts.alert')),
|
|
('represents_alert_group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='alerts.alertgroup')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='PhoneCall',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('exceeded_limit', models.BooleanField(default=None, null=True)),
|
|
('status', models.PositiveSmallIntegerField(blank=True, choices=[(10, 'queued'), (20, 'ringing'), (30, 'in-progress'), (40, 'completed'), (50, 'busy'), (60, 'failed'), (70, 'no-answer'), (80, 'canceled')], null=True)),
|
|
('sid', models.CharField(blank=True, max_length=50)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('notification_policy', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='base.usernotificationpolicy')),
|
|
('receiver', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='user_management.user')),
|
|
('represents_alert', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='alerts.alert')),
|
|
('represents_alert_group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='alerts.alertgroup')),
|
|
],
|
|
),
|
|
]
|