mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
dialect/sql/schema: keep the original name of pg index
This commit is contained in:
@@ -111,8 +111,7 @@ func (t *Table) index(name string) (*Index, bool) {
|
||||
c, ok := t.column(name)
|
||||
if !ok {
|
||||
// Postgres naming convention for unique constraint.
|
||||
name = strings.TrimSuffix(name, "_key")
|
||||
c, ok = t.column(name)
|
||||
c, ok = t.column(strings.TrimSuffix(name, "_key"))
|
||||
}
|
||||
if ok && c.Unique {
|
||||
return &Index{Name: name, Unique: c.Unique, Columns: []*Column{c}, columns: []string{c.Name}}, true
|
||||
|
||||
Reference in New Issue
Block a user