Skip to content

Commit

Permalink
Azure SQL MI supports maximum 100 DB per instance. (#24465)
Browse files Browse the repository at this point in the history
* Azure SQL MI supports maximum 100 DB per instance.

* Error to dialog message

* resolving review comments.

* build fix (Compile & Hygiene)
  • Loading branch information
Ramudaykumar authored Sep 19, 2023
1 parent 0bd0e14 commit ebc7ef5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions extensions/sql-migration/src/constants/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ export const PERF_DATA_COLLECTION_ERROR = (serverName: string, errors: string[])
};
export const SKU_RECOMMENDATION_ASSESSMENT_ERROR_BYPASS = localize('sql.migration.wizard.sku.assessment.error.bypass', 'Check this option to skip assessment and continue the migration.');
export const SKU_RECOMMENDATION_ASSESSMENT_ERROR_DETAIL = localize('sql.migration.wizard.sku.assessment.error.detail', '[There are no assessment results to validate readiness of your database migration. By checking this box, you acknowledge you want to proceed migrating your database to the desired Azure SQL target.]',);
export const AZURE_SQL_MI_DB_COUNT_THRESHOLD_EXCEEDS_ERROR = (selectedDbCount: number): string => {
return localize('sql.migration.select.azure.mi.db.count.threshold.exceeds.error', 'Error: Azure SQL Managed Instance supports maximum {0} user databases per instance. Select {0} or less database(s) to proceed further.', selectedDbCount);
};
export const AZURE_SQL_MI_DB_COUNT_UNDER_THRESHOLD = localize('sql.migration.select.azure.mi.db.count.under.threshold', 'To proceed, press Select button');
export const REFRESH_ASSESSMENT_BUTTON_LABEL = localize('sql.migration.refresh.assessment.button.label', "Refresh assessment");
export const SKU_RECOMMENDATION_CHOOSE_A_TARGET = localize('sql.migration.wizard.sku.choose_a_target', "Choose your Azure SQL target");
export const SKU_RECOMMENDATION_CHOOSE_A_TARGET_HELP = localize('sql.migration.wizard.sku.choose_a_target.help', "Not sure which Azure SQL target is right for you? Learn more");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { selectDatabasesFromList } from '../../constants/helper';
import { getSourceConnectionProfile } from '../../api/sqlUtils';
import { SqlMigrationAssessmentResultItem, SqlMigrationImpactedObjectInfo } from '../../service/contracts';

const AZURE_SQL_MI_DB_COUNT_THRESHOLD = 100;

const styleLeft: azdata.CssStyles = {
'border': 'none',
'text-align': 'left',
Expand Down Expand Up @@ -888,6 +890,14 @@ export class SqlDatabaseTree {
]);
});
} else {
if (this._targetType === MigrationTargetType.SQLMI && selectedDbs?.length > AZURE_SQL_MI_DB_COUNT_THRESHOLD) {
this._dialog.okButton.enabled = false;
this._dialog.message = {
level: azdata.window.MessageLevel.Error,
text: constants.AZURE_SQL_MI_DB_COUNT_THRESHOLD_EXCEEDS_ERROR(AZURE_SQL_MI_DB_COUNT_THRESHOLD),
};
}

instanceTableValues = [[
{
value: this.createIconTextCell(IconPathHelper.sqlServerLogo, this._serverName),
Expand Down Expand Up @@ -933,8 +943,24 @@ export class SqlDatabaseTree {
}

private async updateValuesOnSelection() {
const selectedDbsCount = this.selectedDbs()?.length;
if (this._targetType === MigrationTargetType.SQLMI && selectedDbsCount > AZURE_SQL_MI_DB_COUNT_THRESHOLD) {
this._dialog.okButton.enabled = false;
this._dialog.message = {
level: azdata.window.MessageLevel.Error,
text: constants.AZURE_SQL_MI_DB_COUNT_THRESHOLD_EXCEEDS_ERROR(AZURE_SQL_MI_DB_COUNT_THRESHOLD)
};
}
else if (!this._dialog.okButton.enabled) {
this._dialog.okButton.enabled = true;
this._dialog.message = {
level: azdata.window.MessageLevel.Information,
text: constants.AZURE_SQL_MI_DB_COUNT_UNDER_THRESHOLD
};
}

await this._databaseCount.updateProperties({
'value': constants.DATABASES(this.selectedDbs()?.length, this._model._databasesForAssessment?.length)
'value': constants.DATABASES(selectedDbsCount, this._model._databasesForAssessment?.length)
});
}

Expand Down

0 comments on commit ebc7ef5

Please sign in to comment.