This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2023-12-04 09:11:59 +00:00
|
|
|
# flake8: noqa
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from lifecycle.migrate import BaseMigration
|
|
|
|
|
|
|
|
MEDIA_ROOT = Path(__file__).parent.parent.parent / "media"
|
|
|
|
TENANT_MEDIA_ROOT = MEDIA_ROOT / "tenants"
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(BaseMigration):
|
|
|
|
def needs_migration(self) -> bool:
|
|
|
|
return not TENANT_MEDIA_ROOT.exists()
|
|
|
|
|
|
|
|
def run(self):
|
2023-12-04 09:21:28 +00:00
|
|
|
TENANT_MEDIA_ROOT.mkdir(parents=True)
|
2023-12-04 09:11:59 +00:00
|
|
|
for d in ("application-icons", "source-icons", "flow-backgrounds"):
|
|
|
|
if (MEDIA_ROOT / d).exists():
|
|
|
|
(MEDIA_ROOT / d).rename(TENANT_MEDIA_ROOT / d)
|