|
|
|
@ -234,6 +234,32 @@ public class CustomAlterTableParserListener extends MySqlParserBaseListener {
|
|
|
|
|
super.enterAlterByRenameColumn(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void enterAlterByModifyColumn(MySqlParser.AlterByModifyColumnContext ctx) {
|
|
|
|
|
String oldColumnName = parser.parseName(ctx.uid(0));
|
|
|
|
|
ColumnEditor columnEditor = Column.editor().name(oldColumnName);
|
|
|
|
|
columnEditor.unsetDefaultValueExpression();
|
|
|
|
|
|
|
|
|
|
columnDefinitionListener =
|
|
|
|
|
new CustomColumnDefinitionParserListener(columnEditor, parser, listeners);
|
|
|
|
|
listeners.add(columnDefinitionListener);
|
|
|
|
|
super.enterAlterByModifyColumn(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void exitAlterByModifyColumn(MySqlParser.AlterByModifyColumnContext ctx) {
|
|
|
|
|
parser.runIfNotNull(
|
|
|
|
|
() -> {
|
|
|
|
|
Column column = columnDefinitionListener.getColumn();
|
|
|
|
|
Map<String, DataType> typeMapping = new HashMap<>();
|
|
|
|
|
typeMapping.put(column.name(), fromDbzColumn(column));
|
|
|
|
|
changes.add(new AlterColumnTypeEvent(currentTable, typeMapping));
|
|
|
|
|
listeners.remove(columnDefinitionListener);
|
|
|
|
|
},
|
|
|
|
|
columnDefinitionListener);
|
|
|
|
|
super.exitAlterByModifyColumn(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void exitAlterByRenameColumn(MySqlParser.AlterByRenameColumnContext ctx) {
|
|
|
|
|
parser.runIfNotNull(
|
|
|
|
|