diff options
author | 2019-02-18 20:37:43 +0100 | |
---|---|---|
committer | 2019-02-18 20:37:43 +0100 | |
commit | 1da494439a39046797ab2808e31e86a1e3e80c06 (patch) | |
tree | 15efb9d4bf8ee0ab2d15402c5af4555a74c749a0 /api | |
parent | Add a bot setting model. (diff) |
Create a data migration for the `defcon` settings.
Diffstat (limited to 'api')
-rw-r--r-- | api/migrations/0033_create_defcon_settings.py | 30 |
1 files changed, 30 insertions, 0 deletions
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) + ] |