Skip to content

Commit

Permalink
Merge pull request #807 from Altinity/806-ddl-execution-error-alter-t…
Browse files Browse the repository at this point in the history
…able-employees-drop-constraint-employees_ibfk_2

Added support for DROP CONSTRAINT
  • Loading branch information
subkanthi authored Sep 14, 2024
2 parents 6497ada + 93ab2fe commit b60db22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class Constants {

public static final String DROP_COLUMN = "DROP COLUMN %s";


public static final String DROP_CONSTRAINT = "DROP CONSTRAINT %s";
public static final String NEW_REPLACING_MERGE_TREE_VERSION = "23.2";


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,18 @@ public void enterAlterTable(MySqlParser.AlterTableContext alterTableContext) {
if (tree instanceof AlterByAddColumnContext) {
parseAlterTable(tree);

} else if (tree instanceof MySqlParser.AlterByModifyColumnContext) {
}
else if (tree instanceof MySqlParser.AlterByDropConstraintCheckContext) {
// Drop Constraint.
this.query.append(" ");
for (ParseTree dropConstraintTree : ((MySqlParser.AlterByDropConstraintCheckContext) (tree)).children) {
if (dropConstraintTree instanceof MySqlParser.UidContext) {
System.out.println("Drop Constraint");
this.query.append(String.format(Constants.DROP_CONSTRAINT, dropConstraintTree.getText()));
}
}
}
else if (tree instanceof MySqlParser.AlterByModifyColumnContext) {
parseAlterTable(tree);
} else if (tree instanceof MySqlParser.AlterByDropColumnContext) {
// Drop Column.
Expand Down

0 comments on commit b60db22

Please sign in to comment.