mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-12 03:51:37 -04:00
add schema migration (#24594)
* add schema migration * fix table selection issue * fix table validation * data only wont show schema info grids * address comments * update schema migration helper banner * fix undefined * refactor * endedOn is - when not started * fix toString * refactor * auto referesh dashboardtab and migrationtab * add migration type in dashboard * fix saving issue in page 0 and page 1 * fix compile issue * fix save and close in page 3 * refactor * fix save * fix save * fix save * dont load location twice * fix target type undefined issue * set MI as default * fix cannot load in step 3 * integrate assessment with schema --------- Co-authored-by: Siyang Yao <siyao@microsoft.com>
This commit is contained in:
@@ -153,6 +153,7 @@ export interface SavedInfo {
|
||||
serviceSubscription: azurecore.azureResource.AzureResourceSubscription | null;
|
||||
serviceResourceGroup: azurecore.azureResource.AzureResourceResourceGroup | null;
|
||||
serverAssessment: ServerAssessment | null;
|
||||
xEventsFilesFolderPath: string | null;
|
||||
skuRecommendation: SkuRecommendationSavedInfo | null;
|
||||
}
|
||||
|
||||
@@ -1096,7 +1097,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
});
|
||||
|
||||
// skip databases that don't have tables selected
|
||||
if (selectedTables === 0) {
|
||||
if (selectedTables === 0 && !targetDatabaseInfo?.enableSchemaMigration) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1120,6 +1121,15 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
trustServerCertificate: false,
|
||||
};
|
||||
|
||||
// Schema + data configuration
|
||||
requestBody.properties.sqlSchemaMigrationConfiguration = {
|
||||
enableSchemaMigration: targetDatabaseInfo?.enableSchemaMigration ?? false
|
||||
};
|
||||
|
||||
requestBody.properties.sqlDataMigrationConfiguration = {
|
||||
enableDataMigration: selectedTables > 0
|
||||
};
|
||||
|
||||
// send an empty array when 'all' tables are selected for migration
|
||||
requestBody.properties.tableList = selectedTables === totalTables
|
||||
? []
|
||||
@@ -1178,6 +1188,8 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
response.databaseMigration.properties.sourceDatabaseName = this._databasesForMigration[i];
|
||||
response.databaseMigration.properties.backupConfiguration = requestBody.properties.backupConfiguration!;
|
||||
response.databaseMigration.properties.offlineConfiguration = requestBody.properties.offlineConfiguration!;
|
||||
response.databaseMigration.properties.sqlSchemaMigrationConfiguration = requestBody.properties.sqlSchemaMigrationConfiguration!;
|
||||
response.databaseMigration.properties.sqlDataMigrationConfiguration = requestBody.properties.sqlDataMigrationConfiguration!;
|
||||
|
||||
let wizardEntryPoint = WizardEntryPoint.Default;
|
||||
if (this.resumeAssessment) {
|
||||
@@ -1257,6 +1269,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
targetDatabaseNames: [],
|
||||
sqlMigrationService: undefined,
|
||||
serverAssessment: null,
|
||||
xEventsFilesFolderPath: null,
|
||||
skuRecommendation: null,
|
||||
serviceResourceGroup: null,
|
||||
serviceSubscription: null,
|
||||
@@ -1288,6 +1301,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
saveInfo.migrationTargetType = this._targetType;
|
||||
saveInfo.databaseList = this._databasesForMigration;
|
||||
saveInfo.serverAssessment = this._assessmentResults;
|
||||
saveInfo.xEventsFilesFolderPath = this._xEventsFilesFolderPath;
|
||||
|
||||
if (this._skuRecommendationPerformanceDataSource) {
|
||||
const skuRecommendation: SkuRecommendationSavedInfo = {
|
||||
@@ -1304,6 +1318,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
|
||||
case Page.DatabaseSelector:
|
||||
saveInfo.databaseAssessment = this._databasesForAssessment;
|
||||
saveInfo.xEventsFilesFolderPath = this._xEventsFilesFolderPath;
|
||||
await this.extensionContext.globalState.update(`${this.mementoString}.${serverName}`, saveInfo);
|
||||
}
|
||||
}
|
||||
@@ -1350,10 +1365,12 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
this._sqlMigrationServiceSubscription = this.savedInfo.serviceSubscription || undefined!;
|
||||
this._sqlMigrationServiceResourceGroup = this.savedInfo.serviceResourceGroup || undefined!;
|
||||
|
||||
this._assessedDatabaseList = this.savedInfo.databaseAssessment ?? [];
|
||||
this._databasesForAssessment = this.savedInfo.databaseAssessment ?? [];
|
||||
this._xEventsFilesFolderPath = this.savedInfo.xEventsFilesFolderPath ?? '';
|
||||
const savedAssessmentResults = this.savedInfo.serverAssessment;
|
||||
if (savedAssessmentResults) {
|
||||
this._assessmentResults = savedAssessmentResults;
|
||||
this._assessedDatabaseList = this.savedInfo.databaseAssessment;
|
||||
}
|
||||
|
||||
const savedSkuRecommendation = this.savedInfo.skuRecommendation;
|
||||
|
||||
Reference in New Issue
Block a user