dialect/sql: add drop-fk command to builder

This commit is contained in:
Ariel Mashraki
2019-12-31 21:26:02 +02:00
parent b6cfa43af6
commit ab732c7654
2 changed files with 11 additions and 0 deletions

View File

@@ -264,6 +264,12 @@ func (t *TableAlter) DropConstraint(ident string) *TableAlter {
return t
}
// DropForeignKey appends the `DROP FOREIGN KEY` clause to the given `ALTER TABLE` statement.
func (t *TableAlter) DropForeignKey(ident string) *TableAlter {
t.Queries = append(t.Queries, Raw(fmt.Sprintf("DROP FOREIGN KEY %s", t.Quote(ident))))
return t
}
// Query returns query representation of the `ALTER TABLE` statement.
//
// ALTER TABLE name