mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
dialect/sql: add rename-index to mysql builder (#300)
This commit is contained in:
@@ -252,6 +252,12 @@ func (t *TableAlter) DropColumn(c *ColumnBuilder) *TableAlter {
|
||||
return t
|
||||
}
|
||||
|
||||
// RenameIndex appends the `RENAME INDEX` clause to the given `ALTER TABLE` statement.
|
||||
func (t *TableAlter) RenameIndex(curr, new string) *TableAlter {
|
||||
t.Queries = append(t.Queries, Raw(fmt.Sprintf("RENAME INDEX %s TO %s", t.Quote(curr), t.Quote(new))))
|
||||
return t
|
||||
}
|
||||
|
||||
// AddForeignKey adds a foreign key constraint to the `ALTER TABLE` statement.
|
||||
func (t *TableAlter) AddForeignKey(fk *ForeignKeyBuilder) *TableAlter {
|
||||
t.Queries = append(t.Queries, &Wrapper{"ADD CONSTRAINT %s", fk})
|
||||
|
||||
Reference in New Issue
Block a user