From 1da494439a39046797ab2808e31e86a1e3e80c06 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Mon, 18 Feb 2019 20:37:43 +0100 Subject: Create a data migration for the `defcon` settings. --- api/migrations/0033_create_defcon_settings.py | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 api/migrations/0033_create_defcon_settings.py diff --git a/api/migrations/0033_create_defcon_settings.py b/api/migrations/0033_create_defcon_settings.py new file mode 100644 index 00000000..204f0512 --- /dev/null +++ b/api/migrations/0033_create_defcon_settings.py @@ -0,0 +1,30 @@ +# Generated by Django 2.1.5 on 2019-02-18 19:30 + +from django.db import migrations + + +def up(apps, schema_editor): + BotSetting = apps.get_model('api', 'BotSetting') + setting = BotSetting( + name='defcon', + data={ + 'enabled': False, + 'days': 0 + } + ).save() + + +def down(apps, schema_editor): + BotSetting = apps.get_model('api', 'BotSetting') + BotSetting.get(name='defcon').delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0032_botsetting'), + ] + + operations = [ + migrations.RunPython(up, down) + ] -- cgit v1.2.3