generated from softwareone-platform/swo-extension-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
30 lines (22 loc) · 875 Bytes
/
data.py
File metadata and controls
30 lines (22 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from typing import override
from mpt_tool.commands.base import BaseCommand
from mpt_tool.enums import MigrationTypeEnum
from mpt_tool.use_cases import RunMigrationsUseCase, RunSingleMigrationUseCase
class DataCommand(BaseCommand):
"""Runs all data migrations."""
def __init__(self, migration_id: str | None = None) -> None:
self._migration_id = migration_id
@override
@property
def start_message(self) -> str:
return f"Running {MigrationTypeEnum.DATA} migrations..."
@override
@property
def success_message(self) -> str:
return "Migrations completed successfully."
@override
def run(self) -> None:
if self._migration_id:
RunSingleMigrationUseCase().execute(self._migration_id, MigrationTypeEnum.DATA)
return
RunMigrationsUseCase().execute(MigrationTypeEnum.DATA)