From 82a0b557e154e6d95ba02c4a44819df9f0ed83ed Mon Sep 17 00:00:00 2001 From: dettlaff Date: Sun, 16 Jun 2024 23:48:25 +0400 Subject: [PATCH] feat: add migration for userdata --- selfprivacy_api/migrations/update_userdata.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 selfprivacy_api/migrations/update_userdata.py diff --git a/selfprivacy_api/migrations/update_userdata.py b/selfprivacy_api/migrations/update_userdata.py new file mode 100644 index 0000000..9011731 --- /dev/null +++ b/selfprivacy_api/migrations/update_userdata.py @@ -0,0 +1,25 @@ +from selfprivacy_api.migrations.migration import Migration + +from selfprivacy_api.utils import ReadUserData, WriteUserData + + +class UpdateServicesFlakeList(Migration): + """Check if all required services are in the flake list""" + + def get_migration_name(self): + return "update_services_flake_list" + + def get_migration_description(self): + return "Check if all required services are in the flake list" + + def is_migration_needed(self): + with ReadUserData() as data: + if "roundcube" not in data["modules"]: + return True + + def migrate(self): + with WriteUserData() as data: + data["modules"]["roundcube"] = { + "enable": True, + "subdomain": "roundcube", + }