Skip to content

Commit

Permalink
[#5638] Forgotten change
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaseder committed Jun 2, 2017
1 parent a8ee7b4 commit 43c13ce
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 18 deletions.
6 changes: 6 additions & 0 deletions jOOQ/src/main/java/org/jooq/AlterTableUsingIndexStep.java
Expand Up @@ -57,4 +57,10 @@ public interface AlterTableUsingIndexStep extends AlterTableFinalStep {









}
57 changes: 39 additions & 18 deletions jOOQ/src/main/java/org/jooq/impl/AlterTableImpl.java
Expand Up @@ -57,6 +57,7 @@
// ...
import static org.jooq.impl.DSL.constraint;
import static org.jooq.impl.DSL.field;
import static org.jooq.impl.DSL.index;
import static org.jooq.impl.DSL.inline;
import static org.jooq.impl.DSL.name;
import static org.jooq.impl.DSL.sql;
Expand Down Expand Up @@ -104,6 +105,7 @@
import org.jooq.DSLContext;
import org.jooq.DataType;
import org.jooq.Field;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.SQLDialect;
import org.jooq.Table;
Expand Down Expand Up @@ -134,8 +136,8 @@ final class AlterTableImpl extends AbstractQuery implements
private Table<?> renameTo;
private Field<?> renameColumn;
private Field<?> renameColumnTo;
private Name renameIndex;
private Name renameIndexTo;
private Index renameIndex;
private Index renameIndexTo;
private Constraint renameConstraint;
private Constraint renameConstraintTo;
private Field<?> addColumn;
Expand Down Expand Up @@ -204,15 +206,20 @@ public final AlterTableImpl renameConstraint(Constraint oldName) {
return this;
}

@Override
public final AlterTableImpl renameIndex(String oldName) {
return renameIndex(name(oldName));
}

@Override
public final AlterTableImpl renameIndex(Name oldName) {
renameIndex = oldName;
return this;
return renameIndex(index(oldName));
}

@Override
public final AlterTableImpl renameIndex(String oldName) {
return renameIndex(name(oldName));
public final AlterTableImpl renameIndex(Index oldName) {
renameIndex = oldName;
return this;
}

@Override
Expand All @@ -225,6 +232,24 @@ public final AlterTableImpl renameConstraint(String oldName) {
return renameConstraint(name(oldName));
}

@Override
public final AlterTableImpl to(String newName) {
return to(name(newName));
}

@Override
public final AlterTableImpl to(Name newName) {
if (renameColumn != null)
return to(field(newName));
else if (renameConstraint != null)
return to(constraint(newName));
else if (renameIndex != null) {
return to(index(newName));
}
else
throw new IllegalStateException();
}

@Override
public final AlterTableImpl to(Field<?> newName) {
if (renameColumn != null)
Expand All @@ -246,22 +271,13 @@ public final AlterTableImpl to(Constraint newName) {
}

@Override
public final AlterTableImpl to(Name newName) {
if (renameColumn != null)
return to(field(newName));
else if (renameConstraint != null)
return to(constraint(newName));
else if (renameIndex != null) {
public final AlterTableImpl to(Index newName) {
if (renameIndex != null)
renameIndexTo = newName;
return this;
}
else
throw new IllegalStateException();
}

@Override
public final AlterTableImpl to(String newName) {
return to(name(newName));
return this;
}

@Override
Expand Down Expand Up @@ -315,6 +331,11 @@ public final AlterTableImpl add(Constraint constraint) {








@Override
public final <T> AlterTableImpl alter(Field<T> field) {
return alterColumn(field);
Expand Down

0 comments on commit 43c13ce

Please sign in to comment.