[SQL-Migration] collation errorcode (#21797)

This commit is contained in:
siyang yao
2023-02-01 11:23:21 -08:00
committed by GitHub
parent 51751557b6
commit 749f13d9bf
3 changed files with 14 additions and 4 deletions

View File

@@ -44,6 +44,11 @@ export const LoginMigrationStatusCodes = {
Failed: 'Failed',
};
export const ValidationErrorCodes = {
// TODO: adding other error codes for troubleshooting
SqlInfoValidationFailed: '2056'
};
const _dateFormatter = new Intl.DateTimeFormat(
undefined, {
year: 'numeric',

View File

@@ -408,9 +408,10 @@ export function SQL_TARGET_CONNECTION_DUPLICATE_TARGET_MAPPING(
): string {
return localize(
'sql.migration.wizard.target.mapping.error.duplicate',
"Database mapping error. Target database '{0}' cannot be selected to as a migration target for database '{1}'. Target database '${targetDatabaseName}' is already selected as a migration target for database '{2}'. Please select a different target database.",
"Database mapping error. Target database '{0}' cannot be selected to as a migration target for database '{1}'. Target database '{2}' is already selected as a migration target for database '{3}'. Please select a different target database.",
targetDatabaseName,
sourceDatabaseName,
targetDatabaseName,
mappedSourceDatabaseName);
}
@@ -418,19 +419,21 @@ export function SQL_TARGET_CONNECTION_DUPLICATE_TARGET_MAPPING(
export function SQL_TARGET_CONNECTION_SOURCE_NOT_MAPPED(sourceDatabaseName: string): string {
return localize(
'sql.migration.wizard.target.source.mapping.error',
"Database mapping error. Source database '{0}' is not mapped to a target database. Please select a target database to migrate to.",
"Database mapping error. Source database '{0}' is not mapped to a target database. Please select a target database to migrate to.",
sourceDatabaseName);
}
//`Database mapping error. Source database ({0}) collation ({1}) does not match target database ({2}) collation ({3}). Please select a target database with the same collation to the source database.`
//`A mapping error (Error code: {0}) was found between '{1}' and '{2}' databases. The source database collation '{3}' does not match the target database collation '{4}'. Please select or re-create a target database with the same collation as the source database.`
export function SQL_TARGET_SOURCE_COLLATION_NOT_SAME(
errorCode: string,
sourceDatabaseName: string,
targetDatabaseName: string,
sourceDatabaseCollation: string | undefined,
targetDatabaseCollation: string | undefined): string {
return localize(
'sql.migration.wizard.target.source.collation.error',
"A mapping error was found between '{0}' and '{1}' databases. The source database collation '{2}' does not match the target database collation '{3}'. Please select or re-create a target database with the same collation as the source database.",
"Database mapping error (Error code: {0}) was found between '{1}' and '{2}' databases. The source database collation '{3}' does not match the target database collation '{4}'. Please select or re-create a target database with the same collation as the source database.",
errorCode,
sourceDatabaseName,
targetDatabaseName,
sourceDatabaseCollation,

View File

@@ -17,6 +17,7 @@ import { AzureSqlDatabaseServer, getVMInstanceView, SqlVMServer } from '../api/a
import { collectTargetDatabaseInfo, TargetDatabaseInfo } from '../api/sqlUtils';
import { MigrationLocalStorage, MigrationServiceContext } from '../models/migrationLocalStorage';
import { TdeMigrationDialog } from '../dialog/tdeConfiguration/tdeMigrationDialog';
import { ValidationErrorCodes } from '../constants/helper';
const TDE_MIGRATION_BUTTON_INDEX = 1;
@@ -1167,6 +1168,7 @@ export class TargetSelectionPage extends MigrationWizardPage {
if (!this._isCollationSame(sourceDatabaseCollation, targetDatabaseCollation)) {
collationErrors.push(
constants.SQL_TARGET_SOURCE_COLLATION_NOT_SAME(
ValidationErrorCodes.SqlInfoValidationFailed,
sourceDatabaseName,
targetDatabaseName,
sourceDatabaseCollation,