amsdal 0.3.5__cp312-cp312-macosx_10_13_universal2.whl → 0.4.0__cp312-cp312-macosx_10_13_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of amsdal might be problematic. Click here for more details.
- amsdal/__about__.py +1 -1
- amsdal/__migrations__/0000_initial.py +34 -25
- amsdal/__migrations__/0001_datetime_type.py +4 -4
- amsdal/__migrations__/0002_fixture_order.py +7 -3
- amsdal/__migrations__/0003_schema_type_in_class_meta.py +3 -15
- amsdal/cloud/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/client.cpython-312-darwin.so +0 -0
- amsdal/cloud/constants.cpython-312-darwin.so +0 -0
- amsdal/cloud/enums.cpython-312-darwin.so +0 -0
- amsdal/cloud/models/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/models/base.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_dependency.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_secret.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/base.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/create_deploy.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/create_env.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/create_session.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_env.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_secret.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/expose_db.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_deploys.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_envs.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_secrets.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/manager.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/signup_action.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/update_deploy.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/base.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/credentials.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/credentials.pyi +0 -1
- amsdal/cloud/services/auth/manager.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/signup_service.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/token.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/token.pyi +0 -1
- amsdal/configs/main.py +23 -19
- amsdal/configs/main.pyi +12 -15
- amsdal/contrib/__init__.cpython-312-darwin.so +0 -0
- amsdal/contrib/auth/lifecycle/consumer.py +10 -10
- amsdal/contrib/auth/migrations/0000_initial.py +41 -7
- amsdal/contrib/auth/models/login_session.py +66 -0
- amsdal/contrib/auth/models/login_session.pyi +33 -0
- amsdal/contrib/auth/models/permission.py +23 -0
- amsdal/contrib/auth/models/permission.pyi +18 -0
- amsdal/contrib/auth/models/user.py +106 -0
- amsdal/contrib/auth/models/user.pyi +46 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +47 -15
- amsdal/contrib/frontend_configs/conversion/convert.pyi +0 -1
- amsdal/contrib/frontend_configs/lifecycle/consumer.py +32 -13
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +1 -1
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +15 -14
- amsdal/contrib/frontend_configs/models/__init__.py +0 -0
- amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
- amsdal/errors.py +0 -3
- amsdal/errors.pyi +0 -1
- amsdal/fixtures/__init__.cpython-312-darwin.so +0 -0
- amsdal/fixtures/manager.cpython-312-darwin.so +0 -0
- amsdal/fixtures/manager.pyi +73 -123
- amsdal/fixtures/utils.cpython-312-darwin.so +0 -0
- amsdal/fixtures/utils.pyi +9 -0
- amsdal/manager.cpython-312-darwin.so +0 -0
- amsdal/manager.pyi +4 -96
- amsdal/mixins/__init__.cpython-312-darwin.so +0 -0
- amsdal/mixins/class_versions_mixin.cpython-312-darwin.so +0 -0
- amsdal/models/__init__.py +0 -0
- amsdal/models/__init__.pyi +0 -0
- amsdal/models/core/__init__.py +0 -0
- amsdal/models/core/__init__.pyi +0 -0
- amsdal/models/core/class_object.py +37 -0
- amsdal/models/core/class_object.pyi +24 -0
- amsdal/models/core/class_object_meta.py +26 -0
- amsdal/models/core/class_object_meta.pyi +15 -0
- amsdal/models/core/class_property.py +19 -0
- amsdal/models/core/class_property.pyi +10 -0
- amsdal/models/core/class_property_meta.py +15 -0
- amsdal/models/core/class_property_meta.pyi +10 -0
- amsdal/models/core/file.py +156 -0
- amsdal/models/core/file.pyi +104 -0
- amsdal/models/core/fixture.py +25 -0
- amsdal/models/core/fixture.pyi +14 -0
- amsdal/models/core/option.py +11 -0
- amsdal/models/core/option.pyi +8 -0
- amsdal/models/core/validator.py +12 -0
- amsdal/models/core/validator.pyi +8 -0
- amsdal/models/types/__init__.py +0 -0
- amsdal/models/types/__init__.pyi +0 -0
- amsdal/models/types/object.py +26 -0
- amsdal/models/types/object.pyi +16 -0
- amsdal/schemas/core/file/properties/from_file.py +1 -1
- amsdal/schemas/core/file/properties/validate_data.py +1 -1
- amsdal/schemas/interfaces.py +25 -0
- amsdal/schemas/interfaces.pyi +20 -0
- amsdal/schemas/manager.cpython-312-darwin.so +0 -0
- amsdal/schemas/manager.py +0 -116
- amsdal/schemas/manager.pyi +0 -65
- amsdal/schemas/mixins/__init__.py +0 -0
- amsdal/schemas/mixins/__init__.pyi +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +115 -0
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +42 -0
- amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
- amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
- amsdal/schemas/repository.py +84 -0
- amsdal/schemas/repository.pyi +22 -0
- amsdal/schemas/utils.py +16 -0
- amsdal/schemas/utils.pyi +10 -0
- amsdal/services/__init__.cpython-312-darwin.so +0 -0
- amsdal/services/transaction_execution.cpython-312-darwin.so +0 -0
- amsdal/services/transaction_execution.pyi +1 -1
- amsdal/utils/rollback/__init__.py +99 -54
- amsdal/utils/tests/helpers.py +185 -36
- {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/METADATA +8 -8
- {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/RECORD +150 -142
- {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/WHEEL +1 -1
- amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -68
- amsdal/contrib/auth/models/login_session/model.json +0 -23
- amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -11
- amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +0 -62
- amsdal/contrib/auth/models/permission/model.json +0 -18
- amsdal/contrib/auth/models/permission/modifiers/display_name.py +0 -11
- amsdal/contrib/auth/models/user/hooks/post_init.py +0 -76
- amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -8
- amsdal/contrib/auth/models/user/model.json +0 -25
- amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -19
- amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +0 -11
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +0 -11
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +0 -52
- amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +0 -15
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +0 -6
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +0 -13
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +0 -19
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +0 -26
- amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +0 -41
- amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +0 -250
- amsdal/contrib/frontend_configs/models/frontend_model_config/fixtures/permissions.json +0 -24
- amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +0 -17
- amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +0 -54
- amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +0 -33
- amsdal/migration/__init__.cpython-312-darwin.so +0 -0
- amsdal/migration/base_migration_schemas.cpython-312-darwin.so +0 -0
- amsdal/migration/base_migration_schemas.pyi +0 -120
- amsdal/migration/data_classes.cpython-312-darwin.so +0 -0
- amsdal/migration/data_classes.pyi +0 -172
- amsdal/migration/executors/__init__.cpython-312-darwin.so +0 -0
- amsdal/migration/executors/base.cpython-312-darwin.so +0 -0
- amsdal/migration/executors/base.pyi +0 -118
- amsdal/migration/executors/default_executor.cpython-312-darwin.so +0 -0
- amsdal/migration/executors/default_executor.pyi +0 -184
- amsdal/migration/executors/state_executor.cpython-312-darwin.so +0 -0
- amsdal/migration/executors/state_executor.pyi +0 -151
- amsdal/migration/file_migration_executor.cpython-312-darwin.so +0 -0
- amsdal/migration/file_migration_executor.pyi +0 -122
- amsdal/migration/file_migration_generator.cpython-312-darwin.so +0 -0
- amsdal/migration/file_migration_generator.pyi +0 -229
- amsdal/migration/file_migration_store.cpython-312-darwin.so +0 -0
- amsdal/migration/file_migration_store.pyi +0 -114
- amsdal/migration/file_migration_writer.cpython-312-darwin.so +0 -0
- amsdal/migration/file_migration_writer.pyi +0 -73
- amsdal/migration/migrations.cpython-312-darwin.so +0 -0
- amsdal/migration/migrations.pyi +0 -166
- amsdal/migration/migrations_loader.cpython-312-darwin.so +0 -0
- amsdal/migration/migrations_loader.pyi +0 -32
- amsdal/migration/schemas_loaders.cpython-312-darwin.so +0 -0
- amsdal/migration/schemas_loaders.pyi +0 -37
- amsdal/migration/templates/data_migration.tmpl +0 -18
- amsdal/migration/templates/dict_validator.tmpl +0 -4
- amsdal/migration/templates/migration.tmpl +0 -6
- amsdal/migration/templates/model_class.tmpl +0 -8
- amsdal/migration/templates/model_class_layout.tmpl +0 -24
- amsdal/migration/templates/options_validator.tmpl +0 -4
- amsdal/migration/utils.cpython-312-darwin.so +0 -0
- amsdal/migration/utils.pyi +0 -58
- amsdal/mixins/build_mixin.cpython-312-darwin.so +0 -0
- amsdal/mixins/build_mixin.pyi +0 -78
- /amsdal/{migration/__init__.pyi → contrib/auth/models/__init__.py} +0 -0
- /amsdal/{migration/executors → contrib/auth/models}/__init__.pyi +0 -0
- {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/LICENSE.txt +0 -0
- {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/licenses/LICENSE.txt +0 -0
- {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/top_level.txt +0 -0
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from amsdal.configs.main import settings as settings
|
|
3
|
-
from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
|
|
4
|
-
from amsdal.migration.data_classes import MigrateOperation as MigrateOperation, MigrationFile as MigrationFile, ModuleTypes as ModuleTypes, OperationTypes as OperationTypes
|
|
5
|
-
from amsdal.migration.executors.state_executor import AsyncStateMigrationExecutor as AsyncStateMigrationExecutor, StateMigrationExecutor as StateMigrationExecutor
|
|
6
|
-
from amsdal.migration.file_migration_executor import AsyncFileMigrationExecutorManager as AsyncFileMigrationExecutorManager, FileMigrationExecutorManager as FileMigrationExecutorManager
|
|
7
|
-
from amsdal.migration.file_migration_store import AsyncBaseMigrationStore as AsyncBaseMigrationStore, BaseMigrationStore as BaseMigrationStore
|
|
8
|
-
from amsdal.migration.file_migration_writer import FileMigrationWriter as FileMigrationWriter
|
|
9
|
-
from amsdal.migration.migrations_loader import MigrationsLoader as MigrationsLoader
|
|
10
|
-
from amsdal.migration.schemas_loaders import BaseClassSchemaLoader as BaseClassSchemaLoader
|
|
11
|
-
from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema
|
|
12
|
-
from amsdal_utils.models.enums import SchemaTypes, Versions
|
|
13
|
-
from collections.abc import Callable as Callable
|
|
14
|
-
from pathlib import Path
|
|
15
|
-
from typing import ClassVar
|
|
16
|
-
|
|
17
|
-
class StateMigrationStore(BaseMigrationStore):
|
|
18
|
-
def save_migration(self, migration: MigrationFile) -> None: ...
|
|
19
|
-
def delete_migration(self, migration: MigrationFile) -> None: ...
|
|
20
|
-
def fetch_migrations(self) -> list[MigrationFile]: ...
|
|
21
|
-
|
|
22
|
-
class AsyncStateMigrationStore(AsyncBaseMigrationStore):
|
|
23
|
-
async def save_migration(self, migration: MigrationFile) -> None: ...
|
|
24
|
-
async def delete_migration(self, migration: MigrationFile) -> None: ...
|
|
25
|
-
async def fetch_migrations(self) -> list[MigrationFile]: ...
|
|
26
|
-
|
|
27
|
-
class StateMigrationSchemas(BaseMigrationSchemas):
|
|
28
|
-
"""
|
|
29
|
-
Manages the state of migration schemas.
|
|
30
|
-
|
|
31
|
-
Attributes:
|
|
32
|
-
state (dict[str, tuple[SchemaTypes, ObjectSchema]]): A dictionary mapping class names to their schema types
|
|
33
|
-
and object schemas.
|
|
34
|
-
"""
|
|
35
|
-
state: Incomplete
|
|
36
|
-
def __init__(self) -> None: ...
|
|
37
|
-
def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes, class_version: str | Versions = ...) -> None:
|
|
38
|
-
"""
|
|
39
|
-
Registers a model with the given class name, object schema, and schema type.
|
|
40
|
-
|
|
41
|
-
Args:
|
|
42
|
-
class_name (str): The name of the class to register.
|
|
43
|
-
object_schema (ObjectSchema): The object schema of the class.
|
|
44
|
-
schema_type (SchemaTypes): The type of schema.
|
|
45
|
-
|
|
46
|
-
Returns:
|
|
47
|
-
None
|
|
48
|
-
"""
|
|
49
|
-
def unregister_model(self, class_name: str) -> None:
|
|
50
|
-
"""
|
|
51
|
-
Unregisters a model with the given class name.
|
|
52
|
-
|
|
53
|
-
Args:
|
|
54
|
-
class_name (str): The name of the class to unregister.
|
|
55
|
-
|
|
56
|
-
Returns:
|
|
57
|
-
None
|
|
58
|
-
"""
|
|
59
|
-
def compile_buffered_classes(self) -> None: ...
|
|
60
|
-
|
|
61
|
-
class FileMigrationGenerator:
|
|
62
|
-
"""
|
|
63
|
-
Generates migration files based on schema changes.
|
|
64
|
-
"""
|
|
65
|
-
_operations: ClassVar[dict[OperationTypes, Callable[..., MigrateOperation]]]
|
|
66
|
-
_app_migrations_path: Incomplete
|
|
67
|
-
_app_migrations_loader: Incomplete
|
|
68
|
-
_schema_loader: Incomplete
|
|
69
|
-
_state: Incomplete
|
|
70
|
-
def __init__(self, schema_loader: BaseClassSchemaLoader, app_migrations_path: Path | None = None) -> None: ...
|
|
71
|
-
def make_migrations(self, name: str | None = None, *, is_data: bool = False, schema_type: SchemaTypes = ...) -> MigrationFile:
|
|
72
|
-
"""
|
|
73
|
-
Creates migration files based on schema changes.
|
|
74
|
-
|
|
75
|
-
Args:
|
|
76
|
-
name (str | None): The name of the migration. Defaults to None.
|
|
77
|
-
is_data (bool): If True, creates a data migration. Defaults to False.
|
|
78
|
-
schema_type (SchemaTypes): The type of schema. Defaults to SchemaTypes.USER.
|
|
79
|
-
|
|
80
|
-
Returns:
|
|
81
|
-
MigrationFile: The created migration file.
|
|
82
|
-
|
|
83
|
-
Raises:
|
|
84
|
-
UserWarning: If no changes are detected.
|
|
85
|
-
"""
|
|
86
|
-
def generate_operations(self, schema_type: SchemaTypes) -> list[MigrateOperation]:
|
|
87
|
-
"""
|
|
88
|
-
Generates migration operations based on schema changes.
|
|
89
|
-
|
|
90
|
-
Args:
|
|
91
|
-
schema_type (SchemaTypes): The type of schema.
|
|
92
|
-
|
|
93
|
-
Returns:
|
|
94
|
-
list[MigrateOperation]: List of migration operations.
|
|
95
|
-
"""
|
|
96
|
-
def _make_data_migrations(self, name: str | None = None) -> MigrationFile: ...
|
|
97
|
-
def _init_state(self) -> None: ...
|
|
98
|
-
@classmethod
|
|
99
|
-
def build_operations(cls, schema_type: SchemaTypes, class_schema: ObjectSchema, old_class_schema: ObjectSchema | None) -> list[MigrateOperation]:
|
|
100
|
-
"""
|
|
101
|
-
Builds migration operations based on schema changes.
|
|
102
|
-
|
|
103
|
-
Args:
|
|
104
|
-
schema_type (SchemaTypes): The type of schema.
|
|
105
|
-
class_schema (ObjectSchema): The new class schema.
|
|
106
|
-
old_class_schema (ObjectSchema | None): The old class schema. Defaults to None.
|
|
107
|
-
|
|
108
|
-
Returns:
|
|
109
|
-
list[MigrateOperation]: List of migration operations.
|
|
110
|
-
"""
|
|
111
|
-
def write_migration_file(self, operations: list[MigrateOperation], name: str | None = None) -> MigrationFile:
|
|
112
|
-
"""
|
|
113
|
-
Writes migration operations to a file.
|
|
114
|
-
|
|
115
|
-
Args:
|
|
116
|
-
operations (list[MigrateOperation]): List of migration operations.
|
|
117
|
-
name (str | None): The name of the migration. Defaults to None.
|
|
118
|
-
|
|
119
|
-
Returns:
|
|
120
|
-
MigrationFile: The created migration file.
|
|
121
|
-
"""
|
|
122
|
-
def write_data_migration_file(self, name: str | None = None) -> MigrationFile:
|
|
123
|
-
"""
|
|
124
|
-
Writes data migration operations to a file.
|
|
125
|
-
|
|
126
|
-
Args:
|
|
127
|
-
name (str | None): The name of the migration. Defaults to None.
|
|
128
|
-
|
|
129
|
-
Returns:
|
|
130
|
-
MigrationFile: The created data migration file.
|
|
131
|
-
"""
|
|
132
|
-
@staticmethod
|
|
133
|
-
def generate_name_from_operations(operations: list[MigrateOperation]) -> str:
|
|
134
|
-
"""
|
|
135
|
-
Generates a name for the migration file based on operations.
|
|
136
|
-
|
|
137
|
-
Args:
|
|
138
|
-
operations (list[MigrateOperation]): List of migration operations.
|
|
139
|
-
|
|
140
|
-
Returns:
|
|
141
|
-
str: The generated name.
|
|
142
|
-
"""
|
|
143
|
-
@staticmethod
|
|
144
|
-
def _get_migration_file_name(number: int, name: str) -> str: ...
|
|
145
|
-
|
|
146
|
-
class AsyncFileMigrationGenerator:
|
|
147
|
-
"""
|
|
148
|
-
Generates migration files based on schema changes.
|
|
149
|
-
"""
|
|
150
|
-
_operations: ClassVar[dict[OperationTypes, Callable[..., MigrateOperation]]]
|
|
151
|
-
_app_migrations_path: Incomplete
|
|
152
|
-
_app_migrations_loader: Incomplete
|
|
153
|
-
_schema_loader: Incomplete
|
|
154
|
-
_state: Incomplete
|
|
155
|
-
def __init__(self, schema_loader: BaseClassSchemaLoader, app_migrations_path: Path | None = None) -> None: ...
|
|
156
|
-
async def make_migrations(self, name: str | None = None, *, is_data: bool = False, schema_type: SchemaTypes = ...) -> MigrationFile:
|
|
157
|
-
"""
|
|
158
|
-
Creates migration files based on schema changes.
|
|
159
|
-
|
|
160
|
-
Args:
|
|
161
|
-
name (str | None): The name of the migration. Defaults to None.
|
|
162
|
-
is_data (bool): If True, creates a data migration. Defaults to False.
|
|
163
|
-
schema_type (SchemaTypes): The type of schema. Defaults to SchemaTypes.USER.
|
|
164
|
-
|
|
165
|
-
Returns:
|
|
166
|
-
MigrationFile: The created migration file.
|
|
167
|
-
|
|
168
|
-
Raises:
|
|
169
|
-
UserWarning: If no changes are detected.
|
|
170
|
-
"""
|
|
171
|
-
async def generate_operations(self, schema_type: SchemaTypes) -> list[MigrateOperation]:
|
|
172
|
-
"""
|
|
173
|
-
Generates migration operations based on schema changes.
|
|
174
|
-
|
|
175
|
-
Args:
|
|
176
|
-
schema_type (SchemaTypes): The type of schema.
|
|
177
|
-
|
|
178
|
-
Returns:
|
|
179
|
-
list[MigrateOperation]: List of migration operations.
|
|
180
|
-
"""
|
|
181
|
-
def _make_data_migrations(self, name: str | None = None) -> MigrationFile: ...
|
|
182
|
-
async def _init_state(self) -> None: ...
|
|
183
|
-
@classmethod
|
|
184
|
-
def build_operations(cls, schema_type: SchemaTypes, class_schema: ObjectSchema, old_class_schema: ObjectSchema | None) -> list[MigrateOperation]:
|
|
185
|
-
"""
|
|
186
|
-
Builds migration operations based on schema changes.
|
|
187
|
-
|
|
188
|
-
Args:
|
|
189
|
-
schema_type (SchemaTypes): The type of schema.
|
|
190
|
-
class_schema (ObjectSchema): The new class schema.
|
|
191
|
-
old_class_schema (ObjectSchema | None): The old class schema. Defaults to None.
|
|
192
|
-
|
|
193
|
-
Returns:
|
|
194
|
-
list[MigrateOperation]: List of migration operations.
|
|
195
|
-
"""
|
|
196
|
-
def write_migration_file(self, operations: list[MigrateOperation], name: str | None = None) -> MigrationFile:
|
|
197
|
-
"""
|
|
198
|
-
Writes migration operations to a file.
|
|
199
|
-
|
|
200
|
-
Args:
|
|
201
|
-
operations (list[MigrateOperation]): List of migration operations.
|
|
202
|
-
name (str | None): The name of the migration. Defaults to None.
|
|
203
|
-
|
|
204
|
-
Returns:
|
|
205
|
-
MigrationFile: The created migration file.
|
|
206
|
-
"""
|
|
207
|
-
def write_data_migration_file(self, name: str | None = None) -> MigrationFile:
|
|
208
|
-
"""
|
|
209
|
-
Writes data migration operations to a file.
|
|
210
|
-
|
|
211
|
-
Args:
|
|
212
|
-
name (str | None): The name of the migration. Defaults to None.
|
|
213
|
-
|
|
214
|
-
Returns:
|
|
215
|
-
MigrationFile: The created data migration file.
|
|
216
|
-
"""
|
|
217
|
-
@staticmethod
|
|
218
|
-
def generate_name_from_operations(operations: list[MigrateOperation]) -> str:
|
|
219
|
-
"""
|
|
220
|
-
Generates a name for the migration file based on operations.
|
|
221
|
-
|
|
222
|
-
Args:
|
|
223
|
-
operations (list[MigrateOperation]): List of migration operations.
|
|
224
|
-
|
|
225
|
-
Returns:
|
|
226
|
-
str: The generated name.
|
|
227
|
-
"""
|
|
228
|
-
@staticmethod
|
|
229
|
-
def _get_migration_file_name(number: int, name: str) -> str: ...
|
|
Binary file
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import abc
|
|
2
|
-
from _typeshed import Incomplete
|
|
3
|
-
from abc import ABC, abstractmethod
|
|
4
|
-
from amsdal.configs.main import settings as settings
|
|
5
|
-
from amsdal.migration.data_classes import MigrationFile as MigrationFile, ModuleTypes as ModuleTypes
|
|
6
|
-
from amsdal.migration.utils import contrib_to_module_root_path as contrib_to_module_root_path, map_module_type_to_schema_type as map_module_type_to_schema_type
|
|
7
|
-
from amsdal_utils.models.data_models.address import Address
|
|
8
|
-
from typing import Any, ClassVar
|
|
9
|
-
|
|
10
|
-
class BaseMigrationStore(ABC, metaclass=abc.ABCMeta):
|
|
11
|
-
@abstractmethod
|
|
12
|
-
def fetch_migrations(self) -> list[MigrationFile]: ...
|
|
13
|
-
@abstractmethod
|
|
14
|
-
def save_migration(self, migration: MigrationFile) -> None: ...
|
|
15
|
-
@abstractmethod
|
|
16
|
-
def delete_migration(self, migration: MigrationFile) -> None: ...
|
|
17
|
-
|
|
18
|
-
class AsyncBaseMigrationStore(ABC, metaclass=abc.ABCMeta):
|
|
19
|
-
@abstractmethod
|
|
20
|
-
async def fetch_migrations(self) -> list[MigrationFile]: ...
|
|
21
|
-
@abstractmethod
|
|
22
|
-
async def save_migration(self, migration: MigrationFile) -> None: ...
|
|
23
|
-
@abstractmethod
|
|
24
|
-
async def delete_migration(self, migration: MigrationFile) -> None: ...
|
|
25
|
-
|
|
26
|
-
class FileMigrationStore(BaseMigrationStore):
|
|
27
|
-
"""
|
|
28
|
-
Manages the storage and retrieval of migration files.
|
|
29
|
-
|
|
30
|
-
Attributes:
|
|
31
|
-
migration_address (Address): The address associated with the migration.
|
|
32
|
-
"""
|
|
33
|
-
MIGRATION_TABLE: ClassVar[str]
|
|
34
|
-
migration_address: Address
|
|
35
|
-
_operation_manager: Incomplete
|
|
36
|
-
def __init__(self) -> None: ...
|
|
37
|
-
def fetch_migrations(self) -> list[MigrationFile]:
|
|
38
|
-
"""
|
|
39
|
-
Fetches the list of applied migrations.
|
|
40
|
-
|
|
41
|
-
Returns:
|
|
42
|
-
list[MigrationFile]: List of applied migration files.
|
|
43
|
-
"""
|
|
44
|
-
def save_migration(self, migration: MigrationFile) -> None:
|
|
45
|
-
"""
|
|
46
|
-
Saves a migration file.
|
|
47
|
-
|
|
48
|
-
Args:
|
|
49
|
-
migration (MigrationFile): The migration file to save.
|
|
50
|
-
|
|
51
|
-
Returns:
|
|
52
|
-
None
|
|
53
|
-
"""
|
|
54
|
-
def delete_migration(self, migration: MigrationFile) -> None:
|
|
55
|
-
"""
|
|
56
|
-
Deletes a migration file.
|
|
57
|
-
|
|
58
|
-
Args:
|
|
59
|
-
migration (MigrationFile): The migration file to delete.
|
|
60
|
-
|
|
61
|
-
Returns:
|
|
62
|
-
None
|
|
63
|
-
"""
|
|
64
|
-
def _save_historical_data(self, address: Address, data: dict[str, Any], metadata: dict[str, Any]) -> None: ...
|
|
65
|
-
@staticmethod
|
|
66
|
-
def _build_migration_data(migration: MigrationFile) -> dict[str, Any]: ...
|
|
67
|
-
@classmethod
|
|
68
|
-
def _build_migration_metadata(cls, migration: MigrationFile, object_id: str | None = None) -> tuple[Address, dict[str, Any]]: ...
|
|
69
|
-
def _init_migration_table(self) -> None: ...
|
|
70
|
-
|
|
71
|
-
class AsyncFileMigrationStore(AsyncBaseMigrationStore):
|
|
72
|
-
"""
|
|
73
|
-
Manages the storage and retrieval of migration files.
|
|
74
|
-
|
|
75
|
-
Attributes:
|
|
76
|
-
migration_address (Address): The address associated with the migration.
|
|
77
|
-
"""
|
|
78
|
-
MIGRATION_TABLE: ClassVar[str]
|
|
79
|
-
migration_address: Address
|
|
80
|
-
_operation_manager: Incomplete
|
|
81
|
-
def __init__(self) -> None: ...
|
|
82
|
-
async def fetch_migrations(self) -> list[MigrationFile]:
|
|
83
|
-
"""
|
|
84
|
-
Fetches the list of applied migrations.
|
|
85
|
-
|
|
86
|
-
Returns:
|
|
87
|
-
list[MigrationFile]: List of applied migration files.
|
|
88
|
-
"""
|
|
89
|
-
async def save_migration(self, migration: MigrationFile) -> None:
|
|
90
|
-
"""
|
|
91
|
-
Saves a migration file.
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
migration (MigrationFile): The migration file to save.
|
|
95
|
-
|
|
96
|
-
Returns:
|
|
97
|
-
None
|
|
98
|
-
"""
|
|
99
|
-
async def delete_migration(self, migration: MigrationFile) -> None:
|
|
100
|
-
"""
|
|
101
|
-
Deletes a migration file.
|
|
102
|
-
|
|
103
|
-
Args:
|
|
104
|
-
migration (MigrationFile): The migration file to delete.
|
|
105
|
-
|
|
106
|
-
Returns:
|
|
107
|
-
None
|
|
108
|
-
"""
|
|
109
|
-
async def _save_historical_data(self, address: Address, data: dict[str, Any], metadata: dict[str, Any]) -> None: ...
|
|
110
|
-
@staticmethod
|
|
111
|
-
def _build_migration_data(migration: MigrationFile) -> dict[str, Any]: ...
|
|
112
|
-
@classmethod
|
|
113
|
-
def _build_migration_metadata(cls, migration: MigrationFile, object_id: str | None = None) -> tuple[Address, dict[str, Any]]: ...
|
|
114
|
-
async def _init_migration_table(self) -> None: ...
|
|
Binary file
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
from amsdal.migration.data_classes import MigrateOperation as MigrateOperation, OperationTypes as OperationTypes
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import ClassVar
|
|
4
|
-
|
|
5
|
-
class FileMigrationWriter:
|
|
6
|
-
"""
|
|
7
|
-
Handles the writing of migration files.
|
|
8
|
-
|
|
9
|
-
Attributes:
|
|
10
|
-
template_path (Path): The path to the migration template file.
|
|
11
|
-
data_template_path (Path): The path to the data migration template file.
|
|
12
|
-
operation_name_map (ClassVar[dict[OperationTypes, str]]): A mapping of operation types to their
|
|
13
|
-
string representations.
|
|
14
|
-
"""
|
|
15
|
-
template_path: Path
|
|
16
|
-
data_template_path: Path
|
|
17
|
-
operation_name_map: ClassVar[dict[OperationTypes, str]]
|
|
18
|
-
@classmethod
|
|
19
|
-
def write(cls, file_path: Path, operations: list[MigrateOperation]) -> None:
|
|
20
|
-
"""
|
|
21
|
-
Writes the migration operations to a file.
|
|
22
|
-
|
|
23
|
-
Args:
|
|
24
|
-
file_path (Path): The path to the migration file.
|
|
25
|
-
operations (list[MigrateOperation]): The list of migration operations to write.
|
|
26
|
-
|
|
27
|
-
Returns:
|
|
28
|
-
None
|
|
29
|
-
"""
|
|
30
|
-
@classmethod
|
|
31
|
-
def write_data_migration(cls, file_path: Path) -> None:
|
|
32
|
-
"""
|
|
33
|
-
Writes a data migration to a file.
|
|
34
|
-
|
|
35
|
-
Args:
|
|
36
|
-
file_path (Path): The path to the data migration file.
|
|
37
|
-
|
|
38
|
-
Returns:
|
|
39
|
-
None
|
|
40
|
-
"""
|
|
41
|
-
@classmethod
|
|
42
|
-
def render(cls, operations: list[MigrateOperation]) -> str:
|
|
43
|
-
"""
|
|
44
|
-
Renders the migration operations into a string.
|
|
45
|
-
|
|
46
|
-
Args:
|
|
47
|
-
operations (list[MigrateOperation]): The list of migration operations to render.
|
|
48
|
-
|
|
49
|
-
Returns:
|
|
50
|
-
str: The rendered migration operations as a string.
|
|
51
|
-
"""
|
|
52
|
-
@classmethod
|
|
53
|
-
def render_operation(cls, operation: MigrateOperation) -> str:
|
|
54
|
-
"""
|
|
55
|
-
Renders a single migration operation into a string.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
operation (MigrateOperation): The migration operation to render.
|
|
59
|
-
|
|
60
|
-
Returns:
|
|
61
|
-
str: The rendered migration operation as a string.
|
|
62
|
-
"""
|
|
63
|
-
@classmethod
|
|
64
|
-
def reformat(cls, content: str) -> str:
|
|
65
|
-
"""
|
|
66
|
-
Reformats the content using the Black formatter.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
content (str): The content to reformat.
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
str: The reformatted content.
|
|
73
|
-
"""
|
|
Binary file
|
amsdal/migration/migrations.pyi
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import abc
|
|
2
|
-
from _typeshed import Incomplete
|
|
3
|
-
from abc import ABC, abstractmethod
|
|
4
|
-
from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas, DefaultMigrationSchemas as DefaultMigrationSchemas
|
|
5
|
-
from amsdal.migration.executors.base import BaseMigrationExecutor as BaseMigrationExecutor
|
|
6
|
-
from amsdal_utils.models.enums import SchemaTypes as SchemaTypes
|
|
7
|
-
from collections.abc import Callable as Callable
|
|
8
|
-
from typing import Any
|
|
9
|
-
|
|
10
|
-
class Operation(ABC, metaclass=abc.ABCMeta):
|
|
11
|
-
@abstractmethod
|
|
12
|
-
def forward(self, executor: BaseMigrationExecutor) -> None: ...
|
|
13
|
-
@abstractmethod
|
|
14
|
-
def forward_schema(self, executor: BaseMigrationExecutor) -> None: ...
|
|
15
|
-
@abstractmethod
|
|
16
|
-
def backward(self, executor: BaseMigrationExecutor) -> None: ...
|
|
17
|
-
|
|
18
|
-
class SchemaOperation(Operation):
|
|
19
|
-
"""
|
|
20
|
-
Base class for schema operations.
|
|
21
|
-
|
|
22
|
-
Attributes:
|
|
23
|
-
forward_args (list[Any]): Arguments for the forward operation.
|
|
24
|
-
backward_args (list[Any]): Arguments for the backward operation.
|
|
25
|
-
forward_method_name (str): Name of the method to call for the forward operation.
|
|
26
|
-
backward_method_name (str): Name of the method to call for the backward operation.
|
|
27
|
-
"""
|
|
28
|
-
forward_args: list[Any]
|
|
29
|
-
backward_args: list[Any]
|
|
30
|
-
forward_method_name: str
|
|
31
|
-
backward_method_name: str
|
|
32
|
-
def forward(self, executor: BaseMigrationExecutor) -> None:
|
|
33
|
-
"""
|
|
34
|
-
Executes the forward operation.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
38
|
-
|
|
39
|
-
Returns:
|
|
40
|
-
None
|
|
41
|
-
"""
|
|
42
|
-
def forward_schema(self, executor: BaseMigrationExecutor) -> None:
|
|
43
|
-
"""
|
|
44
|
-
Executes the forward schema operation.
|
|
45
|
-
|
|
46
|
-
Args:
|
|
47
|
-
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
48
|
-
|
|
49
|
-
Returns:
|
|
50
|
-
None
|
|
51
|
-
"""
|
|
52
|
-
def backward(self, executor: BaseMigrationExecutor) -> None:
|
|
53
|
-
"""
|
|
54
|
-
Executes the backward operation.
|
|
55
|
-
|
|
56
|
-
Args:
|
|
57
|
-
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
58
|
-
|
|
59
|
-
Returns:
|
|
60
|
-
None
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
class CreateClass(SchemaOperation):
|
|
64
|
-
"""
|
|
65
|
-
Represents an operation to create a class schema.
|
|
66
|
-
|
|
67
|
-
Attributes:
|
|
68
|
-
forward_method_name (str): The name of the method to call for the forward operation.
|
|
69
|
-
backward_method_name (str): The name of the method to call for the backward operation.
|
|
70
|
-
forward_args (list[Any]): Arguments for the forward operation.
|
|
71
|
-
backward_args (list[Any]): Arguments for the backward operation.
|
|
72
|
-
"""
|
|
73
|
-
forward_method_name: str
|
|
74
|
-
backward_method_name: str
|
|
75
|
-
forward_args: Incomplete
|
|
76
|
-
backward_args: Incomplete
|
|
77
|
-
def __init__(self, class_name: str, new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
|
|
78
|
-
|
|
79
|
-
class UpdateClass(SchemaOperation):
|
|
80
|
-
"""
|
|
81
|
-
Represents an operation to update a class schema.
|
|
82
|
-
|
|
83
|
-
Attributes:
|
|
84
|
-
forward_method_name (str): The name of the method to call for the forward operation.
|
|
85
|
-
backward_method_name (str): The name of the method to call for the backward operation.
|
|
86
|
-
forward_args (list[Any]): Arguments for the forward operation.
|
|
87
|
-
backward_args (list[Any]): Arguments for the backward operation.
|
|
88
|
-
"""
|
|
89
|
-
forward_method_name: str
|
|
90
|
-
backward_method_name: str
|
|
91
|
-
forward_args: Incomplete
|
|
92
|
-
backward_args: Incomplete
|
|
93
|
-
def __init__(self, class_name: str, old_schema: dict[str, Any], new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
|
|
94
|
-
|
|
95
|
-
class DeleteClass(SchemaOperation):
|
|
96
|
-
"""
|
|
97
|
-
Represents an operation to delete a class schema.
|
|
98
|
-
|
|
99
|
-
Attributes:
|
|
100
|
-
forward_method_name (str): The name of the method to call for the forward operation.
|
|
101
|
-
backward_method_name (str): The name of the method to call for the backward operation.
|
|
102
|
-
forward_args (list[Any]): Arguments for the forward operation.
|
|
103
|
-
backward_args (list[Any]): Arguments for the backward operation.
|
|
104
|
-
"""
|
|
105
|
-
forward_method_name: str
|
|
106
|
-
backward_method_name: str
|
|
107
|
-
forward_args: Incomplete
|
|
108
|
-
backward_args: Incomplete
|
|
109
|
-
def __init__(self, class_name: str, old_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
|
|
110
|
-
|
|
111
|
-
class MigrationSchemas(DefaultMigrationSchemas): ...
|
|
112
|
-
|
|
113
|
-
class MigrateData(Operation):
|
|
114
|
-
"""
|
|
115
|
-
Represents a data migration operation.
|
|
116
|
-
|
|
117
|
-
Attributes:
|
|
118
|
-
forward_migration (Callable[[MigrationSchemas \\| BaseMigrationSchemas], None]): The function to call for
|
|
119
|
-
the forward migration.
|
|
120
|
-
backward_migration (Callable[[MigrationSchemas \\| BaseMigrationSchemas], None]): The function to call for
|
|
121
|
-
the backward migration.
|
|
122
|
-
"""
|
|
123
|
-
@staticmethod
|
|
124
|
-
def noop(schemas: MigrationSchemas) -> None: ...
|
|
125
|
-
forward_migration: Incomplete
|
|
126
|
-
backward_migration: Incomplete
|
|
127
|
-
def __init__(self, forward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None], backward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None]) -> None: ...
|
|
128
|
-
def forward(self, executor: BaseMigrationExecutor) -> None:
|
|
129
|
-
"""
|
|
130
|
-
Executes the forward data migration.
|
|
131
|
-
|
|
132
|
-
Args:
|
|
133
|
-
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
134
|
-
|
|
135
|
-
Returns:
|
|
136
|
-
None
|
|
137
|
-
"""
|
|
138
|
-
def backward(self, executor: BaseMigrationExecutor) -> None:
|
|
139
|
-
"""
|
|
140
|
-
Executes the backward data migration.
|
|
141
|
-
|
|
142
|
-
Args:
|
|
143
|
-
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
144
|
-
|
|
145
|
-
Returns:
|
|
146
|
-
None
|
|
147
|
-
"""
|
|
148
|
-
def forward_schema(self, executor: BaseMigrationExecutor) -> None:
|
|
149
|
-
"""
|
|
150
|
-
No-op for forward schema in data migration.
|
|
151
|
-
|
|
152
|
-
Args:
|
|
153
|
-
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
154
|
-
|
|
155
|
-
Returns:
|
|
156
|
-
None
|
|
157
|
-
"""
|
|
158
|
-
|
|
159
|
-
class Migration:
|
|
160
|
-
"""
|
|
161
|
-
Represents a collection of migration operations.
|
|
162
|
-
|
|
163
|
-
Attributes:
|
|
164
|
-
operations (list[Operation]): The list of migration operations.
|
|
165
|
-
"""
|
|
166
|
-
operations: list[Operation]
|
|
Binary file
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from amsdal.migration.data_classes import MigrationFile as MigrationFile, ModuleTypes as ModuleTypes
|
|
3
|
-
from collections.abc import Iterator
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
class MigrationsLoader:
|
|
7
|
-
"""
|
|
8
|
-
Loads and manages migration files from a specified directory.
|
|
9
|
-
"""
|
|
10
|
-
_migrations_path: Incomplete
|
|
11
|
-
_module_type: Incomplete
|
|
12
|
-
_module_name: Incomplete
|
|
13
|
-
_migrations_files: Incomplete
|
|
14
|
-
def __init__(self, migrations_dir: Path, module_type: ModuleTypes, module_name: str | None = None) -> None: ...
|
|
15
|
-
@property
|
|
16
|
-
def has_initial_migration(self) -> bool:
|
|
17
|
-
"""
|
|
18
|
-
Checks if there is an initial migration file.
|
|
19
|
-
|
|
20
|
-
Returns:
|
|
21
|
-
bool: True if there is an initial migration file, False otherwise.
|
|
22
|
-
"""
|
|
23
|
-
@property
|
|
24
|
-
def last_migration_number(self) -> int:
|
|
25
|
-
"""
|
|
26
|
-
Gets the number of the last migration file.
|
|
27
|
-
|
|
28
|
-
Returns:
|
|
29
|
-
int: The number of the last migration file, or -1 if there are no migration files.
|
|
30
|
-
"""
|
|
31
|
-
def __iter__(self) -> Iterator[MigrationFile]: ...
|
|
32
|
-
def _load_migration_files(self) -> None: ...
|
|
Binary file
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import abc
|
|
2
|
-
from _typeshed import Incomplete
|
|
3
|
-
from abc import ABC, abstractmethod
|
|
4
|
-
from amsdal.configs.constants import CORE_SCHEMAS_PATH as CORE_SCHEMAS_PATH, TYPE_SCHEMAS_PATH as TYPE_SCHEMAS_PATH
|
|
5
|
-
from amsdal.configs.main import settings as settings
|
|
6
|
-
from amsdal.migration.data_classes import ClassSchema as ClassSchema, ModuleTypes as ModuleTypes
|
|
7
|
-
from amsdal_models.schemas.mixins.enrich_schemas_mixin import EnrichSchemasMixin
|
|
8
|
-
from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema
|
|
9
|
-
from collections.abc import Iterator
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
|
|
12
|
-
class BaseClassSchemaLoader(ABC, metaclass=abc.ABCMeta):
|
|
13
|
-
@abstractmethod
|
|
14
|
-
def iter_app_schemas(self) -> Iterator[ClassSchema]: ...
|
|
15
|
-
|
|
16
|
-
class JsonClassSchemaLoader(EnrichSchemasMixin, BaseClassSchemaLoader):
|
|
17
|
-
"""
|
|
18
|
-
Loads and enriches JSON class schemas from a specified root path.
|
|
19
|
-
|
|
20
|
-
Attributes:
|
|
21
|
-
schemas_root_path (Path): The root path to the JSON schemas.
|
|
22
|
-
module_type (ModuleTypes): The type of the module for the schemas.
|
|
23
|
-
"""
|
|
24
|
-
schemas_root_path: Incomplete
|
|
25
|
-
module_type: Incomplete
|
|
26
|
-
def __init__(self, schemas_root_path: Path, module_type: ModuleTypes = ...) -> None: ...
|
|
27
|
-
def iter_app_schemas(self) -> Iterator[ClassSchema]:
|
|
28
|
-
"""
|
|
29
|
-
Iterates over the application schemas.
|
|
30
|
-
|
|
31
|
-
Yields:
|
|
32
|
-
ClassSchema: The next class schema in the iteration.
|
|
33
|
-
"""
|
|
34
|
-
def _enriched_user_schemas(self) -> list[ObjectSchema]: ...
|
|
35
|
-
@staticmethod
|
|
36
|
-
def _load_schemas(schemas_path: Path) -> list[ObjectSchema]: ...
|
|
37
|
-
def _load_contrib_schemas(self) -> list[ObjectSchema]: ...
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from amsdal.migration import migrations
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def forward_migration(schemas: migrations.MigrationSchemas) -> None:
|
|
5
|
-
...
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def backward_migration(schemas: migrations.MigrationSchemas) -> None:
|
|
9
|
-
...
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Migration(migrations.Migration):
|
|
13
|
-
operations: list[migrations.Operation] = [
|
|
14
|
-
migrations.MigrateData(
|
|
15
|
-
forward_migration=forward_migration,
|
|
16
|
-
backward_migration=backward_migration,
|
|
17
|
-
),
|
|
18
|
-
]
|