[jOOQ/jOOQ#9534] Add support ALTER TABLE .. DROP UNIQUE <name>
This commit is contained in:
parent
d8b8977339
commit
86e7fa40b4
@ -638,6 +638,46 @@ public interface AlterTableStep {
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
AlterTableDropStep dropPrimaryKey(String constraint);
|
||||
|
||||
/**
|
||||
* Add a <code>DROP UNIQUE</code> clause to the <code>ALTER TABLE</code>
|
||||
* statement.
|
||||
* <p>
|
||||
* Some dialects (e.g. {@link SQLDialect#COCKROACHDB}) may not be able to
|
||||
* drop constraints by name. If users specify the constraint type
|
||||
* <em>and</em> the name, however, then the syntax can be emulated, e.g.
|
||||
* using <code>DROP INDEX .. CASCADE</code>.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
AlterTableDropStep dropUnique(Constraint constraint);
|
||||
|
||||
/**
|
||||
* Add a <code>DROP UNIQUE</code> clause to the <code>ALTER TABLE</code>
|
||||
* statement.
|
||||
* <p>
|
||||
* Some dialects (e.g. {@link SQLDialect#COCKROACHDB}) may not be able to
|
||||
* drop constraints by name. If users specify the constraint type
|
||||
* <em>and</em> the name, however, then the syntax can be emulated, e.g.
|
||||
* using <code>DROP INDEX .. CASCADE</code>.
|
||||
*
|
||||
* @see DSL#constraint(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
AlterTableDropStep dropUnique(Name constraint);
|
||||
|
||||
/**
|
||||
* Add a <code>DROP UNIQUE</code> clause to the <code>ALTER TABLE</code>
|
||||
* statement.
|
||||
* <p>
|
||||
* Some dialects (e.g. {@link SQLDialect#COCKROACHDB}) may not be able to
|
||||
* drop constraints by name. If users specify the constraint type
|
||||
* <em>and</em> the name, however, then the syntax can be emulated, e.g.
|
||||
* using <code>DROP INDEX .. CASCADE</code>.
|
||||
*
|
||||
* @see DSL#constraint(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
AlterTableDropStep dropUnique(String constraint);
|
||||
|
||||
/**
|
||||
* Add a <code>DROP FOREIGN KEY</code> clause to the <code>ALTER TABLE</code>
|
||||
* statement.
|
||||
|
||||
@ -76,6 +76,7 @@ import static org.jooq.impl.Cascade.CASCADE;
|
||||
import static org.jooq.impl.Cascade.RESTRICT;
|
||||
import static org.jooq.impl.ConstraintType.FOREIGN_KEY;
|
||||
import static org.jooq.impl.ConstraintType.PRIMARY_KEY;
|
||||
import static org.jooq.impl.ConstraintType.UNIQUE;
|
||||
import static org.jooq.impl.DSL.begin;
|
||||
import static org.jooq.impl.DSL.commentOnTable;
|
||||
import static org.jooq.impl.DSL.condition;
|
||||
@ -826,6 +827,23 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
return dropPrimaryKey(constraint(constraint));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final AlterTableImpl dropUnique(Constraint constraint) {
|
||||
dropConstraint = constraint;
|
||||
dropConstraintType = UNIQUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final AlterTableImpl dropUnique(Name constraint) {
|
||||
return dropUnique(constraint(constraint));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final AlterTableImpl dropUnique(String constraint) {
|
||||
return dropUnique(constraint(constraint));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final AlterTableImpl dropForeignKey(Constraint constraint) {
|
||||
dropConstraint = constraint;
|
||||
@ -1009,6 +1027,13 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user