Skip to content

Commit

Permalink
0005370: Send schema DDL detects widened varchar but does not alter
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Aug 1, 2022
1 parent ab31a73 commit 67eacf1
Showing 1 changed file with 0 additions and 25 deletions.
Expand Up @@ -323,32 +323,7 @@ public String alterTable(Table currentTable, Table desiredTable,
return alterDatabase(currentModel, desiredModel, alterDatabaseInterceptors);
}

/**
* When the platform columns were added alters were not taken into consideration. Therefore, we copy the desiredPlatformColumn to the current platform
* column because the alter code ends up using the current column to come up with the alter statements. This is a hack that depends on the fact that none of
* the alter decision are based upon the current column's platform column.
*/
protected void mergeOrRemovePlatformTypes(Database currentModel, Database desiredModel) {
Table[] currentTables = currentModel.getTables();
for (Table currentTable : currentTables) {
/*
* Warning - we don't currently support altering tables across different catalogs and schemas, so we only need to look up by name
*/
Table desiredTable = findTable(desiredModel, currentTable.getName());
if (desiredTable != null) {
Column[] currentColumns = currentTable.getColumns();
for (Column currentColumn : currentColumns) {
Column desiredColumn = desiredTable.getColumnWithName(currentColumn.getName());
if (desiredColumn != null) {
currentColumn.removePlatformColumn(databaseName);
PlatformColumn desiredPlatformColumn = desiredColumn.findPlatformColumn(databaseName);
if (desiredPlatformColumn != null) {
currentColumn.addPlatformColumn(desiredPlatformColumn);
}
}
}
}
}
}

/**
Expand Down

0 comments on commit 67eacf1

Please sign in to comment.