amsdal_cli 0.4.15__py3-none-any.whl → 0.5.0__py3-none-any.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.
@@ -1185,4 +1185,39 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1185
1185
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1186
1186
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1187
1187
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1188
- THE SOFTWARE.
1188
+ THE SOFTWARE.
1189
+
1190
+ ## click **v8**
1191
+
1192
+ ### [https://github.com/pallets/click/](https://github.com/pallets/click/)
1193
+
1194
+ ### **BSD-3-Clause license**
1195
+
1196
+ Copyright 2014 Pallets
1197
+
1198
+ Redistribution and use in source and binary forms, with or without
1199
+ modification, are permitted provided that the following conditions are
1200
+ met:
1201
+
1202
+ 1. Redistributions of source code must retain the above copyright
1203
+ notice, this list of conditions and the following disclaimer.
1204
+
1205
+ 2. Redistributions in binary form must reproduce the above copyright
1206
+ notice, this list of conditions and the following disclaimer in the
1207
+ documentation and/or other materials provided with the distribution.
1208
+
1209
+ 3. Neither the name of the copyright holder nor the names of its
1210
+ contributors may be used to endorse or promote products derived from
1211
+ this software without specific prior written permission.
1212
+
1213
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1214
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1215
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
1216
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1217
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1218
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
1219
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1220
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1221
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1222
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1223
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
amsdal_cli/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2023-present
2
2
  #
3
3
  # SPDX-License-Identifier: AMSDAL End User License Agreement
4
- __version__ = '0.4.15'
4
+ __version__ = '0.5.0'
@@ -246,7 +246,6 @@ def _check_missing_generated_migrations(
246
246
  from amsdal.configs.constants import CORE_MIGRATIONS_PATH
247
247
  from amsdal.configs.main import settings
248
248
  from amsdal_models.migration.file_migration_generator import FileMigrationGenerator
249
- from amsdal_utils.models.enums import ModuleType
250
249
 
251
250
  from amsdal_cli.commands.migrations.constants import MIGRATIONS_DIR_NAME
252
251
  from amsdal_cli.utils.cli_config import ModelsFormat
@@ -270,8 +269,9 @@ def _check_missing_generated_migrations(
270
269
  app_migrations_path=migrations_dir,
271
270
  contrib_migrations_directory_name=settings.CONTRIB_MODELS_PACKAGE_NAME,
272
271
  )
272
+ generator.init_state()
273
273
 
274
- operations = generator.generate_operations(schema_repository.user_schemas, ModuleType.USER)
274
+ operations = generator.app_file_migration_generator.generate_operations(schema_repository.user_schemas)
275
275
 
276
276
  if operations:
277
277
  rprint(rich_error('Missing generated migrations. Use `amsdal migrations new` to fix. Exiting...'))
@@ -295,7 +295,6 @@ async def _async_check_missing_generated_migrations(
295
295
  from amsdal.configs.constants import CORE_MIGRATIONS_PATH
296
296
  from amsdal.configs.main import settings
297
297
  from amsdal_models.migration.file_migration_generator import AsyncFileMigrationGenerator
298
- from amsdal_utils.models.enums import ModuleType
299
298
 
300
299
  from amsdal_cli.commands.migrations.constants import MIGRATIONS_DIR_NAME
301
300
  from amsdal_cli.utils.cli_config import ModelsFormat
@@ -321,8 +320,9 @@ async def _async_check_missing_generated_migrations(
321
320
  app_migrations_path=migrations_dir,
322
321
  contrib_migrations_directory_name=settings.CONTRIB_MODELS_PACKAGE_NAME,
323
322
  )
323
+ await generator.init_state()
324
324
 
325
- operations = await generator.generate_operations(schema_repository.user_schemas, ModuleType.USER)
325
+ operations = generator.app_file_migration_generator.generate_operations(schema_repository.user_schemas)
326
326
 
327
327
  if operations:
328
328
  rprint(rich_error('Missing generated migrations. Use `amsdal migrations new` to fix. Exiting...'))
@@ -16,9 +16,9 @@ from amsdal_cli.commands.generate.enums import TestType
16
16
  def generate_tests(
17
17
  ctx: typer.Context,
18
18
  model_name: str = typer.Option(..., help='The model name. It should be provided in PascalCase.'),
19
- test_type: TestType = typer.Option(TestType.UNIT, help='The type of test to generate.'), # noqa: B008
19
+ test_type: TestType = typer.Option(TestType.UNIT.value, help='The type of test to generate.'), # noqa: B008
20
20
  test_data_type: TestDataType = typer.Option( # noqa: B008
21
- TestDataType.DYNAMIC,
21
+ TestDataType.DYNAMIC.value,
22
22
  help='The type of test data to generate.',
23
23
  ),
24
24
  config: Annotated[Path, typer.Option(..., '--config', '-c')] = None, # type: ignore # noqa: RUF013
@@ -47,6 +47,7 @@ def _sync_apply(
47
47
  app_migrations_loader = MigrationsLoader(
48
48
  migrations_dir=build_dir / MIGRATIONS_DIR_NAME,
49
49
  module_type=ModuleType.USER,
50
+ module_name=settings.MIGRATIONS_DIRECTORY_NAME,
50
51
  )
51
52
  schemas = MigrationSchemas()
52
53
 
@@ -101,7 +102,6 @@ async def _async_sync_apply(
101
102
  from amsdal_models.migration.data_classes import MigrationResult
102
103
  from amsdal_models.migration.executors.default_executor import DefaultAsyncMigrationExecutor
103
104
  from amsdal_models.migration.file_migration_executor import AsyncFileMigrationExecutorManager
104
- from amsdal_models.migration.file_migration_store import AsyncFileMigrationStore
105
105
  from amsdal_models.migration.migrations import MigrationSchemas
106
106
  from amsdal_models.migration.migrations_loader import MigrationsLoader
107
107
 
@@ -116,14 +116,13 @@ async def _async_sync_apply(
116
116
 
117
117
  try:
118
118
  amsdal_manager.authenticate()
119
- store = AsyncFileMigrationStore(build_dir / MIGRATIONS_DIR_NAME)
120
119
 
121
- await store.init_migration_table()
122
120
  await amsdal_manager.post_setup()
123
121
 
124
122
  app_migrations_loader = MigrationsLoader(
125
123
  migrations_dir=build_dir / MIGRATIONS_DIR_NAME,
126
124
  module_type=ModuleType.USER,
125
+ module_name=settings.MIGRATIONS_DIRECTORY_NAME,
127
126
  )
128
127
  schemas = MigrationSchemas()
129
128
 
@@ -211,7 +210,7 @@ def apply_migrations(
211
210
  ] = None, # type: ignore[assignment]
212
211
  build_dir: Annotated[Path, typer.Option(..., '--build-dir', '-b')] = Path('.'),
213
212
  *,
214
- module_type: Annotated[ModuleType, typer.Option(..., '--module', '-m')] = ModuleType.USER,
213
+ module_type: Annotated[ModuleType, typer.Option(..., '--module', '-m')] = ModuleType.USER.value, # type: ignore
215
214
  fake: Annotated[bool, typer.Option('--fake', '-f')] = False,
216
215
  config: Annotated[Path, typer.Option(..., '--config', '-c')] = None, # type: ignore # noqa: RUF013
217
216
  ) -> None:
@@ -22,6 +22,8 @@ def _fetch_migrations(app_migrations_path: Path) -> list['MigrationFile']:
22
22
  amsdal_manager.post_setup()
23
23
 
24
24
  store = FileMigrationStore(app_migrations_path)
25
+ store.init_migration_table()
26
+
25
27
  return store.fetch_migrations()
26
28
 
27
29
 
@@ -94,6 +96,7 @@ def list_migrations(
94
96
  core_loader = MigrationsLoader(
95
97
  migrations_dir=CORE_MIGRATIONS_PATH,
96
98
  module_type=ModuleType.CORE,
99
+ module_name='amsdal.__migrations__',
97
100
  )
98
101
  contrib_loaders: list[tuple[str, MigrationsLoader]] = []
99
102
 
@@ -114,6 +117,7 @@ def list_migrations(
114
117
  app_migrations_loader = MigrationsLoader(
115
118
  migrations_dir=build_dir / MIGRATIONS_DIR_NAME,
116
119
  module_type=ModuleType.USER,
120
+ module_name=settings.MIGRATIONS_DIRECTORY_NAME,
117
121
  )
118
122
 
119
123
  rprint(rich_success('Core:'))
@@ -44,7 +44,7 @@ def _sync_make_migrations(
44
44
  generator = FileMigrationGenerator(
45
45
  core_migrations_path=CORE_MIGRATIONS_PATH,
46
46
  app_migrations_path=migrations_dir,
47
- contrib_migrations_directory_name=settings.CONTRIB_MODELS_PACKAGE_NAME,
47
+ contrib_migrations_directory_name=settings.CONTRIB_MIGRATIONS_DIRECTORY_NAME,
48
48
  )
49
49
 
50
50
  try:
@@ -122,7 +122,7 @@ def make_migrations(
122
122
  build_dir: Annotated[Path, typer.Option('--build-dir', '-b')] = Path('.'),
123
123
  *,
124
124
  name: Annotated[str, typer.Option('--name', '-n', help='Migration name')] = None, # type: ignore # noqa: RUF013
125
- is_data: Annotated[bool, typer.Option('--data', '-d', is_flag=True, help='Create data migration')] = False,
125
+ is_data: Annotated[bool, typer.Option('--data', '-d', help='Create data migration')] = False,
126
126
  config: Annotated[Path, typer.Option('--config', '-c')] = None, # type: ignore # noqa: RUF013
127
127
  ) -> None:
128
128
  """
@@ -72,7 +72,7 @@ def _migrate_models(config_path: Path) -> None:
72
72
  from amsdal_models.classes.class_loader import ModelClassLoader
73
73
  from amsdal_models.migration import migrations
74
74
  from amsdal_models.migration.executors.default_executor import DefaultMigrationExecutor
75
- from amsdal_models.migration.file_migration_generator import FileMigrationGenerator
75
+ from amsdal_models.migration.file_migration_generator import BaseFileMigrationGenerator
76
76
  from amsdal_models.migration.file_migration_writer import FileMigrationWriter
77
77
  from amsdal_models.migration.migrations import MigrationSchemas
78
78
  from amsdal_models.schemas.class_schema_loader import ClassSchemaLoader
@@ -121,7 +121,8 @@ def _migrate_models(config_path: Path) -> None:
121
121
  _schemas_map = {_schema.title: _schema for _schema in _schemas}
122
122
 
123
123
  for object_schema in _schemas:
124
- for _operation_data in FileMigrationGenerator.build_operations(
124
+
125
+ for _operation_data in BaseFileMigrationGenerator.build_operations(
125
126
  ModuleType.USER,
126
127
  object_schema,
127
128
  None,
@@ -136,7 +137,7 @@ def _migrate_models(config_path: Path) -> None:
136
137
  _operation.forward(executor)
137
138
 
138
139
  for object_schema in _cycle_schemas:
139
- for _operation_data in FileMigrationGenerator.build_operations(
140
+ for _operation_data in BaseFileMigrationGenerator.build_operations(
140
141
  ModuleType.USER,
141
142
  object_schema,
142
143
  _schemas_map[object_schema.title],
@@ -163,7 +164,7 @@ async def _async_migrate_models(config_path: Path) -> None:
163
164
  from amsdal_models.classes.class_loader import ModelClassLoader
164
165
  from amsdal_models.migration import migrations
165
166
  from amsdal_models.migration.executors.default_executor import DefaultAsyncMigrationExecutor
166
- from amsdal_models.migration.file_migration_generator import AsyncFileMigrationGenerator
167
+ from amsdal_models.migration.file_migration_generator import BaseFileMigrationGenerator
167
168
  from amsdal_models.migration.file_migration_writer import FileMigrationWriter
168
169
  from amsdal_models.migration.migrations import MigrationSchemas
169
170
  from amsdal_models.schemas.class_schema_loader import ClassSchemaLoader
@@ -211,7 +212,7 @@ async def _async_migrate_models(config_path: Path) -> None:
211
212
  _schemas_map = {_schema.title: _schema for _schema in _schemas}
212
213
 
213
214
  for object_schema in _schemas:
214
- for _operation_data in AsyncFileMigrationGenerator.build_operations(
215
+ for _operation_data in BaseFileMigrationGenerator.build_operations(
215
216
  ModuleType.USER,
216
217
  object_schema,
217
218
  None,
@@ -226,7 +227,7 @@ async def _async_migrate_models(config_path: Path) -> None:
226
227
  _operation.forward(executor)
227
228
 
228
229
  for object_schema in _cycle_schemas:
229
- for _operation_data in AsyncFileMigrationGenerator.build_operations(
230
+ for _operation_data in BaseFileMigrationGenerator.build_operations(
230
231
  ModuleType.USER,
231
232
  object_schema,
232
233
  _schemas_map[object_schema.title],
@@ -264,6 +264,8 @@ async def _async_restore_models(app_source_path: Path, cli_config: 'CliConfig')
264
264
 
265
265
  def _restore_state_db(cli_config: 'CliConfig', config_path: Path | None) -> None:
266
266
  from amsdal_data.connections.constants import SECONDARY_PARTITION_KEY
267
+ from amsdal_data.connections.historical.data_query_transform import META_FOREIGN_KEYS
268
+ from amsdal_data.connections.historical.data_query_transform import META_PRIMARY_KEY_FIELDS
267
269
  from amsdal_data.utils import object_schema_to_glue_schema
268
270
  from amsdal_utils.config.manager import AmsdalConfigManager
269
271
 
@@ -277,6 +279,12 @@ def _restore_state_db(cli_config: 'CliConfig', config_path: Path | None) -> None
277
279
 
278
280
  class_object_ref, class_object_meta_ref = _get_class_object_reference(lakehouse_connection)
279
281
  model_pks, model_fks, model_m2ms = _fetch_model_pks_and_fks(lakehouse_connection, class_object_ref)
282
+
283
+ expected_m2m_tables: set[str] = set()
284
+ for model_name, m2m_list in model_m2ms.items():
285
+ for _, m2m_value in m2m_list.items():
286
+ expected_m2m_tables.add(f'{model_name}{m2m_value[1]}')
287
+
280
288
  user_schemas = _get_user_schemas(
281
289
  lakehouse_connection,
282
290
  class_object_ref,
@@ -287,7 +295,8 @@ def _restore_state_db(cli_config: 'CliConfig', config_path: Path | None) -> None
287
295
  user_scheams_with_tries = [(table_ref, schema, 0) for table_ref, schema in user_schemas]
288
296
  refs_by_name = {table_ref.name: table_ref for table_ref, _ in user_schemas}
289
297
 
290
- m2m_all_data = []
298
+ m2m_schemas = [schema for schema in user_schemas if schema[0].name in expected_m2m_tables]
299
+
291
300
  while user_scheams_with_tries:
292
301
  table_ref, schema, current_iteration = user_scheams_with_tries.pop(0)
293
302
  rprint(rich_info(f'Restoring {table_ref.name}'))
@@ -316,7 +325,7 @@ def _restore_state_db(cli_config: 'CliConfig', config_path: Path | None) -> None
316
325
 
317
326
  from amsdal_data.connections.historical.data_query_transform import META_CLASS_NAME
318
327
 
319
- data, m2m_data = _build_data(
328
+ data, _ = _build_data(
320
329
  item,
321
330
  model_name=table_ref.metadata[META_CLASS_NAME], # type: ignore[index]
322
331
  model_pks=model_pks,
@@ -325,7 +334,6 @@ def _restore_state_db(cli_config: 'CliConfig', config_path: Path | None) -> None
325
334
  refs_by_name=refs_by_name,
326
335
  )
327
336
 
328
- m2m_all_data.extend(m2m_data)
329
337
  state_connection.run_mutations(
330
338
  mutations=[
331
339
  glue.InsertData(
@@ -339,12 +347,79 @@ def _restore_state_db(cli_config: 'CliConfig', config_path: Path | None) -> None
339
347
  ],
340
348
  )
341
349
  rprint('.', end='')
350
+
342
351
  rprint('Inserting m2m data...')
352
+ m2m_all_data = []
353
+ for schema_ref, schema in m2m_schemas:
354
+ _datas = []
355
+ _objects = lakehouse_connection.query(glue.QueryStatement(table=schema_ref))
356
+ field1, field2 = schema.required
357
+ prop1 = schema.properties[field1] # type: ignore[index]
358
+ prop2 = schema.properties[field2] # type: ignore[index]
359
+
360
+ rprint(rich_info(f'Found {len(_objects)} m2m objects for {schema_ref.name}...'))
361
+ for _item in _objects:
362
+ obj_id_1 = _item.data[field1]['ref']['object_id']
363
+ obj_id_2 = _item.data[field2]['ref']['object_id']
364
+ _datas.append(
365
+ glue.Data(
366
+ data={
367
+ f'{field1}_partition_key': obj_id_1,
368
+ f'{field2}_partition_key': obj_id_2,
369
+ },
370
+ metadata={
371
+ META_PRIMARY_KEY_FIELDS: {
372
+ f'{field1}_partition_key': str,
373
+ f'{field2}_partition_key': str,
374
+ },
375
+ META_FOREIGN_KEYS: {
376
+ f'{field1}_partition_key': {
377
+ 'ref': {
378
+ 'resource': 'statedb',
379
+ 'class_name': prop1.type,
380
+ 'object_id': obj_id_1,
381
+ 'class_version': 'LATEST',
382
+ 'object_version': 'LATEST',
383
+ },
384
+ },
385
+ f'{field2}_partition_key': {
386
+ 'ref': {
387
+ 'resource': 'statedb',
388
+ 'class_name': prop2.type,
389
+ 'object_id': obj_id_2,
390
+ 'class_version': 'LATEST',
391
+ 'object_version': 'LATEST',
392
+ },
393
+ },
394
+ },
395
+ },
396
+ )
397
+ )
398
+
399
+ if _datas:
400
+ m2m_all_data.append(
401
+ glue.InsertData(
402
+ schema=glue.SchemaReference(
403
+ name=schema_ref.name,
404
+ version=glue.Version.LATEST,
405
+ metadata=schema_ref.metadata,
406
+ ),
407
+ data=_datas,
408
+ )
409
+ )
343
410
  for _m2m_data in m2m_all_data:
344
- try:
345
- state_connection.run_mutations(mutations=[_m2m_data])
346
- except Exception:
347
- rprint('Error inserting m2m data')
411
+ for data in _m2m_data.data:
412
+ try:
413
+ state_connection.run_mutations(
414
+ mutations=[
415
+ glue.InsertData(
416
+ schema=_m2m_data.schema,
417
+ data=[data],
418
+ ),
419
+ ]
420
+ )
421
+ except Exception:
422
+ rprint('Error inserting m2m data')
348
423
 
349
424
  rprint(rich_success('Done! All classes are restored.'))
350
425
 
@@ -175,7 +175,6 @@ def _check_migrations_generated_and_applied(
175
175
  from amsdal.configs.constants import CORE_MIGRATIONS_PATH
176
176
  from amsdal.configs.main import settings
177
177
  from amsdal_models.migration.file_migration_generator import FileMigrationGenerator
178
- from amsdal_utils.models.enums import ModuleType
179
178
 
180
179
  from amsdal_cli.commands.generate.enums import SOURCES_DIR
181
180
  from amsdal_cli.commands.migrations.constants import MIGRATIONS_DIR_NAME
@@ -192,10 +191,11 @@ def _check_migrations_generated_and_applied(
192
191
  generator = FileMigrationGenerator(
193
192
  core_migrations_path=CORE_MIGRATIONS_PATH,
194
193
  app_migrations_path=migrations_dir,
195
- contrib_migrations_directory_name=settings.CONTRIB_MODELS_PACKAGE_NAME,
194
+ contrib_migrations_directory_name=settings.CONTRIB_MIGRATIONS_DIRECTORY_NAME,
196
195
  )
196
+ generator.init_state()
197
197
 
198
- operations = generator.generate_operations(schemas=schema_repository.user_schemas, module_type=ModuleType.USER)
198
+ operations = generator.app_file_migration_generator.generate_operations(schemas=schema_repository.user_schemas)
199
199
 
200
200
  if operations:
201
201
  rprint(
@@ -226,6 +226,7 @@ def _check_has_unapplied_migrations(
226
226
  core_loader = MigrationsLoader(
227
227
  migrations_dir=CORE_MIGRATIONS_PATH,
228
228
  module_type=ModuleType.CORE,
229
+ module_name='amsdal.__migrations__',
229
230
  )
230
231
 
231
232
  schemas = DefaultMigrationSchemas()
@@ -251,6 +252,7 @@ def _check_has_unapplied_migrations(
251
252
  MigrationsLoader(
252
253
  migrations_dir=build_dir / MIGRATIONS_DIR_NAME,
253
254
  module_type=ModuleType.USER,
255
+ module_name=settings.MIGRATIONS_DIRECTORY_NAME,
254
256
  ),
255
257
  all_applied_migrations,
256
258
  schemas,
@@ -263,7 +265,7 @@ def _check_has_unapplied_migrations_per_loader(
263
265
  schemas: 'DefaultMigrationSchemas',
264
266
  ) -> bool:
265
267
  from amsdal_models.migration.executors.state_executor import StateMigrationExecutor
266
- from amsdal_models.migration.file_migration_executor import FileMigrationExecutorManager
268
+ from amsdal_models.migration.file_migration_executor import BaseMigrationExecutorManager
267
269
  from amsdal_models.migration.migrations import MigrateData
268
270
 
269
271
  from amsdal_cli.utils.text import rich_warning
@@ -278,7 +280,8 @@ def _check_has_unapplied_migrations_per_loader(
278
280
  return True
279
281
  else:
280
282
  # Register classes from migrations
281
- migration_class = FileMigrationExecutorManager.get_migration_class(_migration)
283
+
284
+ migration_class = BaseMigrationExecutorManager.get_migration_class(_migration)
282
285
  migration_class_instance = migration_class()
283
286
  state_executor = StateMigrationExecutor(
284
287
  schemas,
@@ -451,6 +454,7 @@ async def _async_check_has_unapplied_migrations(
451
454
  core_loader = MigrationsLoader(
452
455
  migrations_dir=CORE_MIGRATIONS_PATH,
453
456
  module_type=ModuleType.CORE,
457
+ module_name='amsdal.__migrations__',
454
458
  )
455
459
  schemas = DefaultMigrationSchemas()
456
460
 
@@ -475,6 +479,7 @@ async def _async_check_has_unapplied_migrations(
475
479
  MigrationsLoader(
476
480
  migrations_dir=build_dir / MIGRATIONS_DIR_NAME,
477
481
  module_type=ModuleType.USER,
482
+ module_name=settings.MIGRATIONS_DIRECTORY_NAME,
478
483
  ),
479
484
  all_applied_migrations,
480
485
  schemas,
@@ -488,7 +493,6 @@ async def _async_check_migrations_generated_and_applied(
488
493
  from amsdal.configs.constants import CORE_MIGRATIONS_PATH
489
494
  from amsdal.configs.main import settings
490
495
  from amsdal_models.migration.file_migration_generator import AsyncFileMigrationGenerator
491
- from amsdal_utils.models.enums import ModuleType
492
496
 
493
497
  from amsdal_cli.commands.generate.enums import SOURCES_DIR
494
498
  from amsdal_cli.commands.migrations.constants import MIGRATIONS_DIR_NAME
@@ -505,11 +509,11 @@ async def _async_check_migrations_generated_and_applied(
505
509
  generator = AsyncFileMigrationGenerator(
506
510
  core_migrations_path=CORE_MIGRATIONS_PATH,
507
511
  app_migrations_path=migrations_dir,
508
- contrib_migrations_directory_name=settings.CONTRIB_MODELS_PACKAGE_NAME,
512
+ contrib_migrations_directory_name=settings.CONTRIB_MIGRATIONS_DIRECTORY_NAME,
509
513
  )
510
- operations = await generator.generate_operations(
514
+ await generator.init_state()
515
+ operations = generator.app_file_migration_generator.generate_operations(
511
516
  schemas=schema_repository.user_schemas,
512
- module_type=ModuleType.USER,
513
517
  )
514
518
 
515
519
  if operations:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amsdal_cli
3
- Version: 0.4.15
3
+ Version: 0.5.0
4
4
  Summary: CLI for AMSDAL framework
5
5
  Project-URL: Documentation, https://pypi.org/project/amsdal_cli/#readme
6
6
  Project-URL: Issues, https://pypi.org/project/amsdal_cli/
@@ -121,14 +121,15 @@ Classifier: Programming Language :: Python :: 3.12
121
121
  Classifier: Programming Language :: Python :: Implementation :: CPython
122
122
  Classifier: Programming Language :: Python :: Implementation :: PyPy
123
123
  Requires-Python: >=3.11
124
- Requires-Dist: amsdal-server==0.4.*
124
+ Requires-Dist: amsdal-server==0.5.*
125
+ Requires-Dist: click<8.2.0
125
126
  Requires-Dist: faker==27.*
126
127
  Requires-Dist: gitpython~=3.1
127
128
  Requires-Dist: jinja2~=3.1
128
129
  Requires-Dist: pydantic-settings~=2.2
129
130
  Requires-Dist: pydantic~=2.3
130
- Requires-Dist: rich~=13.9
131
- Requires-Dist: typer~=0.15.2
131
+ Requires-Dist: rich~=14.0
132
+ Requires-Dist: typer~=0.15.3
132
133
  Requires-Dist: watchfiles~=0.21
133
134
  Description-Content-Type: text/markdown
134
135
 
@@ -1,5 +1,5 @@
1
- amsdal_cli/Third-Party Materials - AMSDAL Dependencies - License Notices.md,sha256=eHOIhsC6pZv3Wf8aKfaBNJhVi20gM6Rm2PakZTrdIOQ,66641
2
- amsdal_cli/__about__.py,sha256=Vt5HE1-j6RiDhtwMPfWimxDBngSXFXCGjWUa7ycqsJY,125
1
+ amsdal_cli/Third-Party Materials - AMSDAL Dependencies - License Notices.md,sha256=uHJlGG0D4tbpUi8cq-497NNO9ltQ67a5448k-T14HTw,68241
2
+ amsdal_cli/__about__.py,sha256=TbPNaTH0RD4R7lbHg7ldzYno1o55MHD6GiUpoGifv0c,124
3
3
  amsdal_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  amsdal_cli/app.py,sha256=_ucuLT5ospf1ifFKEG0IMfVnxKjnvPUQ4iMhkvOfCrc,466
5
5
  amsdal_cli/main.py,sha256=LtH-BD1eJrAUecjKzC8Gx7kYFUstOMH1erdeJUVqFB8,144
@@ -58,7 +58,7 @@ amsdal_cli/commands/cloud/deploy/command.py,sha256=LIX07pTU55GUA9KmTiKDtoCj5Ytx9
58
58
  amsdal_cli/commands/cloud/deploy/sub_commands/__init__.py,sha256=I7MJEyceCIgCXP7JpX06nLvEA6HUkjj9LSDAb7VfTGo,353
59
59
  amsdal_cli/commands/cloud/deploy/sub_commands/deploy_delete.py,sha256=pRLumeigF4e_Nod32p6XkgJsYxbB9H3WSxbv0IwA5Eo,3221
60
60
  amsdal_cli/commands/cloud/deploy/sub_commands/deploy_list.py,sha256=Nm-uaAmCjLP9UDFNM-E79QLAiqy6_9VQSTd_W8bKoE0,5532
61
- amsdal_cli/commands/cloud/deploy/sub_commands/deploy_new.py,sha256=FTcILPoesHXGvZlsax8VivKE3Ghw63fKK1EAIenSoWU,12718
61
+ amsdal_cli/commands/cloud/deploy/sub_commands/deploy_new.py,sha256=Pv6wJo34SmGGHaEE4HPKwnOkJ0fzB979xvr6-yWxUlA,12690
62
62
  amsdal_cli/commands/cloud/environments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
63
  amsdal_cli/commands/cloud/environments/app.py,sha256=kkzf_kW2jpl3d44qWuIZB5C3uWXzpNpnTIvUpuuPJHE,238
64
64
  amsdal_cli/commands/cloud/environments/command.py,sha256=roeg2tpa53W1qzCa_3-zEn5z2xiVS4STWB9M7P5BVKA,283
@@ -108,7 +108,7 @@ amsdal_cli/commands/generate/sub_commands/generate_model.py,sha256=5IgbkMqPHBBHI
108
108
  amsdal_cli/commands/generate/sub_commands/generate_modifier.py,sha256=NyN7vMTBGaQv6u815WT1lqAlqI4xP1AmIZWq5edZ-5g,1426
109
109
  amsdal_cli/commands/generate/sub_commands/generate_permission.py,sha256=gfRhZsnNnd_m_HxdOCB8C22tbMkopg2FTKo-T68b13s,2824
110
110
  amsdal_cli/commands/generate/sub_commands/generate_property.py,sha256=XrCjf48oEzuMPqsTuC5Qsn1WbIQzUVW8BNOmXssfUM8,1599
111
- amsdal_cli/commands/generate/sub_commands/generate_tests.py,sha256=5AwhsfAFCOnV-R6FTW7cqECJbw36gK5ixEv7N7Do5zM,4606
111
+ amsdal_cli/commands/generate/sub_commands/generate_tests.py,sha256=9n237ZMWzxp9Bq-QooFeynG_jDmjA42EBJkRt4S3AsE,4618
112
112
  amsdal_cli/commands/generate/sub_commands/generate_transaction.py,sha256=hBHceRNqqxVVqIBmMkMOcRG5AM_PB3Pc7ABdm5oeytE,1640
113
113
  amsdal_cli/commands/generate/templates/async_transaction.pyt,sha256=HDnJpIzSuf5h0lYLXDYv_w4LqjJNEl6FMybeT9A19uI,173
114
114
  amsdal_cli/commands/generate/templates/hook.pyt,sha256=nqToFKu6GIxrXWlpg5IN9rK8nkZ07F4sH-aZEQaTfpY,261
@@ -135,9 +135,9 @@ amsdal_cli/commands/migrations/app.py,sha256=0HsKjZ5D2j9xkOi2Fuvs3VdlhWyQnS8XJ6p
135
135
  amsdal_cli/commands/migrations/command.py,sha256=jlpdYZAc02ZUBxSdzGSzkDxEb1nlHNzoq05FdRCSzus,206
136
136
  amsdal_cli/commands/migrations/constants.py,sha256=846-DQ-Iqcxw2akd5aBAmbnXHDmRFqEKu6vai2ZFBkU,35
137
137
  amsdal_cli/commands/migrations/sub_commands/__init__.py,sha256=_rWbDyY3DPdN-6vE60djCtHejvSkl6d1e2Z4ScM52bo,976
138
- amsdal_cli/commands/migrations/sub_commands/apply.py,sha256=26wMVtzBpJawbFPpiXSUGItmzd1XORymcIBgbonVZgw,9475
139
- amsdal_cli/commands/migrations/sub_commands/list.py,sha256=xOfonot6JAs3ApXe-QRLKfJf2kVsj7TalEMwK3V_uC4,5439
140
- amsdal_cli/commands/migrations/sub_commands/make.py,sha256=y-SWaGzWx2apuTA57prStSo09VjH7Q9ZNjzEvbVzwo8,6272
138
+ amsdal_cli/commands/migrations/sub_commands/apply.py,sha256=QTMK4v8SGYTGjTKJVLqe5g0CVyM-Gpt6C95okO5YP5M,9412
139
+ amsdal_cli/commands/migrations/sub_commands/list.py,sha256=crzicPfLTM7a3SD6O_Cgyo9GotbI-4iyf6xDqpinUFw,5574
140
+ amsdal_cli/commands/migrations/sub_commands/make.py,sha256=ay51nl0b1QBrw8pmV5hw3DX1nqX5_dWFdqFMbQhkff0,6264
141
141
  amsdal_cli/commands/new/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
142
  amsdal_cli/commands/new/command.py,sha256=NDuDZNwreyuHsv4tbE-yrNOJViB8wk35IcKvGKQXPXo,3302
143
143
  amsdal_cli/commands/new/templates/.amsdal-cli,sha256=PdXPovcT8AfPhqwDLI_4EWFYAS6e3J5JcsHVityBdF8,304
@@ -156,15 +156,15 @@ amsdal_cli/commands/register_connection/utils/config_updater.py,sha256=CDsaCuli5
156
156
  amsdal_cli/commands/register_connection/utils/credentials.py,sha256=iaAF5STbKJNIoT8vL30DafTn4uzYnrjumtM3XNHuOS8,1066
157
157
  amsdal_cli/commands/register_connection/utils/initialize.py,sha256=PMFoqAIxFB1xzY56FFX2-pRJ_CZbwUbgD25m0Pk1b48,1080
158
158
  amsdal_cli/commands/register_connection/utils/meta.py,sha256=PDs2miN0SPW2hCATLY8uGe1WOzDyw-D6my90P-mpcl8,709
159
- amsdal_cli/commands/register_connection/utils/migrate_models.py,sha256=XN7pPE7KsqEVcQzTCymIn7lIgX4n6UEZkv1v_HlBdgU,13902
159
+ amsdal_cli/commands/register_connection/utils/migrate_models.py,sha256=2_C7_X_OrQB0GtiPsos7Ndm62Q-qVRBl-4o--XPclLw,13912
160
160
  amsdal_cli/commands/register_connection/utils/model_generator.py,sha256=w0vz-i-tMdimcQYmFbtfpOZJF8heTTRIzu1yTdbKBpc,10853
161
161
  amsdal_cli/commands/register_connection/utils/tables.py,sha256=FOwbWOpEw485Leoqe8LXCVY5osGKTKlMqWD9oqosapk,474
162
162
  amsdal_cli/commands/restore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
163
- amsdal_cli/commands/restore/command.py,sha256=ya3aHpMLpgF_vMAGSTbBuSHIUwC4FaHhMiwrD6AglTo,32833
163
+ amsdal_cli/commands/restore/command.py,sha256=DZ27U8BXkMsxhiqYfQ64wduC-0UYq7UPcZfYRHgZ8nA,36004
164
164
  amsdal_cli/commands/restore/enums.py,sha256=6SiKMRGlSjiLyepfbfQFXGAYqlM6Bkoeko2KscntTUQ,307
165
165
  amsdal_cli/commands/serve/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
166
  amsdal_cli/commands/serve/command.py,sha256=tjm1T0yrA2P6nlk_KDNv6Gih2Dkt5nMIN-_WUrLhn58,6541
167
- amsdal_cli/commands/serve/utils.py,sha256=h-t6trB0nf7bJyz2vU42AQYdbi5DDmF3qHwtqb5R_Yc,17381
167
+ amsdal_cli/commands/serve/utils.py,sha256=aOvi3_HUGKxV2AIBhDrr1o0WvcDYijbj2fjGBAzX8zI,17544
168
168
  amsdal_cli/commands/serve/filters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
169
169
  amsdal_cli/commands/serve/filters/models_watch_filter.py,sha256=cnoAjrn-PYDAFq5MtgbQ6QeCvJJmcNisVNlA8QtFv4A,170
170
170
  amsdal_cli/commands/serve/filters/static_files_watch_filter.py,sha256=jKAF5RHq1au2v0kcOrqaAHP1x5IUjt_KgZURJLm29Tw,552
@@ -199,8 +199,8 @@ amsdal_cli/utils/vcs/base.py,sha256=jC05ExJZDnyHAsW7_4IDf8gQcYgK4dXq3zNlFIX66T4,
199
199
  amsdal_cli/utils/vcs/dummy.py,sha256=Lk8MT-b0YlHHUsiXsq5cvmPwcl4jTYdo8piN5_C8ORA,434
200
200
  amsdal_cli/utils/vcs/enums.py,sha256=tYR9LN1IOr8BZFbSeX_vDlhn8fPl4IU-Yakii8lRDYs,69
201
201
  amsdal_cli/utils/vcs/git.py,sha256=xHynbZcV6p2D3RFCwu1MGGpV9D7eK-pGUtO8kVexTQM,1269
202
- amsdal_cli-0.4.15.dist-info/METADATA,sha256=C2wbd4XfyBm4IVkKuOfzMtGjzSixhsnr2ZucwAf-A1E,57050
203
- amsdal_cli-0.4.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
204
- amsdal_cli-0.4.15.dist-info/entry_points.txt,sha256=GC-8LZsD3W--Pd9_gD4W3tw3ZZyPbSvkZ-qWc9Fx0NI,47
205
- amsdal_cli-0.4.15.dist-info/licenses/LICENSE.txt,sha256=hG-541PFYfNJi9WRZi_hno91UyqNg7YLK8LR3vLblZA,27355
206
- amsdal_cli-0.4.15.dist-info/RECORD,,
202
+ amsdal_cli-0.5.0.dist-info/METADATA,sha256=d85Aily08gtU21WumuK6fKYrpPWHuWL3QEwc0q8Uyqk,57076
203
+ amsdal_cli-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
204
+ amsdal_cli-0.5.0.dist-info/entry_points.txt,sha256=GC-8LZsD3W--Pd9_gD4W3tw3ZZyPbSvkZ-qWc9Fx0NI,47
205
+ amsdal_cli-0.5.0.dist-info/licenses/LICENSE.txt,sha256=hG-541PFYfNJi9WRZi_hno91UyqNg7YLK8LR3vLblZA,27355
206
+ amsdal_cli-0.5.0.dist-info/RECORD,,