提交 c5eca800 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Simplify CommandWithColumns.addConstraintCommand()

上级 e862609d
...@@ -43,20 +43,15 @@ public abstract class CommandWithColumns extends SchemaCommand { ...@@ -43,20 +43,15 @@ public abstract class CommandWithColumns extends SchemaCommand {
* the statement to add * the statement to add
*/ */
public void addConstraintCommand(DefineCommand command) { public void addConstraintCommand(DefineCommand command) {
if (command instanceof CreateIndex) { if (!(command instanceof CreateIndex)) {
getConstraintCommands().add(command);
} else {
AlterTableAddConstraint con = (AlterTableAddConstraint) command; AlterTableAddConstraint con = (AlterTableAddConstraint) command;
boolean alreadySet;
if (con.getType() == CommandInterface.ALTER_TABLE_ADD_CONSTRAINT_PRIMARY_KEY) { if (con.getType() == CommandInterface.ALTER_TABLE_ADD_CONSTRAINT_PRIMARY_KEY) {
alreadySet = setPrimaryKey(con); if (setPrimaryKey(con)) {
} else { return;
alreadySet = false; }
}
if (!alreadySet) {
getConstraintCommands().add(command);
} }
} }
getConstraintCommands().add(command);
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论