mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 12:11:26 +00:00
feat: add migration for userdata
This commit is contained in:
parent
7b9420c244
commit
82a0b557e1
25
selfprivacy_api/migrations/update_userdata.py
Normal file
25
selfprivacy_api/migrations/update_userdata.py
Normal file
|
@ -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",
|
||||||
|
}
|
Loading…
Reference in a new issue