From 2fa3435c429685ae858c3cdaafd4af9d6f21878e Mon Sep 17 00:00:00 2001 From: Artem Pavlichenko Date: Fri, 7 Apr 2023 13:49:17 -0700 Subject: [PATCH 1/2] Adding support for database schema migration --- src/azure-cli/azure/cli/command_modules/dms/_help.py | 4 +++- .../azure/cli/command_modules/dms/scenario_inputs.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/dms/_help.py b/src/azure-cli/azure/cli/command_modules/dms/_help.py index d61b4497c87..99a6250062a 100644 --- a/src/azure-cli/azure/cli/command_modules/dms/_help.py +++ b/src/azure-cli/azure/cli/command_modules/dms/_help.py @@ -287,7 +287,9 @@ // optional, migrates the enumerated events 'selected_events': [ 'sourceSchema1.nightly_maintenance' - ] + ], + // Optional. If true, the database will be selected for schema migration. + "select_database_for_schema_migration": "true|false" }, ...n ], diff --git a/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py b/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py index fde04dcc72c..be71e664cc0 100644 --- a/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py +++ b/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py @@ -189,6 +189,7 @@ def create_db_input(database, has_schema_migration_options): set_optional(db_properties, 'selectedTriggers', database, 'selected_triggers', throw_if_not_list) set_optional(db_properties, 'selectedRoutines', database, 'selected_routines', throw_if_not_list) set_optional(db_properties, 'selectedEvents', database, 'selected_events', throw_if_not_list) + set_optional(db_properties, 'selectDatabaseForSchemaMigration', database, 'select_database_for_schema_migration') if len(db_properties) > 0: db_input.additional_properties = db_properties From 7dca014c00abb6e0bc866dce3e9efeb8f399483a Mon Sep 17 00:00:00 2001 From: Artem Pavlichenko Date: Fri, 7 Apr 2023 15:37:11 -0700 Subject: [PATCH 2/2] Fixing build issues and addressing pr feedback --- src/azure-cli/azure/cli/command_modules/dms/_help.py | 4 ++-- .../azure/cli/command_modules/dms/scenario_inputs.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/dms/_help.py b/src/azure-cli/azure/cli/command_modules/dms/_help.py index 99a6250062a..85e09c3a844 100644 --- a/src/azure-cli/azure/cli/command_modules/dms/_help.py +++ b/src/azure-cli/azure/cli/command_modules/dms/_help.py @@ -191,7 +191,7 @@ -) source -> target :: task type 1) SQL -> SQLDB :: OfflineMigration 2) PostgreSQL -> AzureDbForPostgreSql :: OnlineMigration - 3) MySQL -> AzureDbForMySQL :: OfflineMigration + 3) MySQL -> AzureDbForMySQL :: OfflineMigration, OnlineMigration, ReplicateChanges parameters: - name: --task-type type: string @@ -288,7 +288,7 @@ 'selected_events': [ 'sourceSchema1.nightly_maintenance' ], - // Optional. If true, the database will be selected for schema migration. + // Optional. If true, DMS will migrate the source database schema to the target. "select_database_for_schema_migration": "true|false" }, ...n diff --git a/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py b/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py index be71e664cc0..624f3bac2ee 100644 --- a/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py +++ b/src/azure-cli/azure/cli/command_modules/dms/scenario_inputs.py @@ -189,7 +189,10 @@ def create_db_input(database, has_schema_migration_options): set_optional(db_properties, 'selectedTriggers', database, 'selected_triggers', throw_if_not_list) set_optional(db_properties, 'selectedRoutines', database, 'selected_routines', throw_if_not_list) set_optional(db_properties, 'selectedEvents', database, 'selected_events', throw_if_not_list) - set_optional(db_properties, 'selectDatabaseForSchemaMigration', database, 'select_database_for_schema_migration') + set_optional(db_properties, + 'selectDatabaseForSchemaMigration', + database, + 'select_database_for_schema_migration') if len(db_properties) > 0: db_input.additional_properties = db_properties