mirror of
https://github.com/ent/ent.git
synced 2026-05-04 16:40:55 +03:00
dialect/sql/schema: fix postgres index migration (#1351)
Fix PostgreSQL index migration when table_name = type_name. Closed #1344
This commit is contained in:
@@ -390,9 +390,7 @@ func (m *Migrate) changeSet(curr, new *Table) (*changes, error) {
|
||||
|
||||
// Drop indexes.
|
||||
for _, idx := range curr.Indexes {
|
||||
_, ok1 := new.fk(idx.Name)
|
||||
_, ok2 := new.index(idx.Name)
|
||||
if !ok1 && !ok2 {
|
||||
if _, isFK := new.fk(idx.Name); !isFK && !new.hasIndex(idx.Name, idx.realname) {
|
||||
change.index.drop.append(idx)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user