2022-01-11 05:36:11 +00:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
2022-01-11 05:41:25 +00:00
|
|
|
|
2022-01-11 05:36:11 +00:00
|
|
|
class Migration(ABC):
|
2022-02-16 13:03:38 +00:00
|
|
|
"""
|
|
|
|
Abstract Migration class
|
|
|
|
This class is used to define the structure of a migration
|
|
|
|
Migration has a function is_migration_needed() that returns True or False
|
|
|
|
Migration has a function migrate() that does the migration
|
|
|
|
Migration has a function get_migration_name() that returns the migration name
|
|
|
|
Migration has a function get_migration_description() that returns the migration description
|
|
|
|
"""
|
|
|
|
|
2022-01-11 05:36:11 +00:00
|
|
|
@abstractmethod
|
2024-06-26 12:00:51 +00:00
|
|
|
def get_migration_name(self) -> str:
|
2022-01-11 05:36:11 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2024-06-26 12:00:51 +00:00
|
|
|
def get_migration_description(self) -> str:
|
2022-01-11 05:36:11 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2024-06-26 12:00:51 +00:00
|
|
|
def is_migration_needed(self) -> bool:
|
2022-01-11 05:36:11 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2024-06-26 12:00:51 +00:00
|
|
|
def migrate(self) -> None:
|
2022-01-11 05:36:11 +00:00
|
|
|
pass
|