2024-06-16 19:48:25 +00:00
|
|
|
from selfprivacy_api.migrations.migration import Migration
|
|
|
|
|
|
|
|
from selfprivacy_api.utils import ReadUserData, WriteUserData
|
|
|
|
|
|
|
|
|
2024-06-19 11:20:31 +00:00
|
|
|
class AddRoundcubeToUserdata(Migration):
|
|
|
|
"""Add Roundcube to userdata.json if it does not exist"""
|
2024-06-16 19:48:25 +00:00
|
|
|
|
|
|
|
def get_migration_name(self):
|
2024-06-19 11:20:31 +00:00
|
|
|
return "add_roundcube_to_userdata"
|
2024-06-16 19:48:25 +00:00
|
|
|
|
|
|
|
def get_migration_description(self):
|
2024-06-19 11:20:31 +00:00
|
|
|
return "Add Roundcube to userdata.json if it does not exist"
|
2024-06-16 19:48:25 +00:00
|
|
|
|
|
|
|
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"] = {
|
|
|
|
"subdomain": "roundcube",
|
|
|
|
}
|