From 58486009c2d7c2b390b5b2b518f28df8bdde4ddd Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Sun, 15 Dec 2019 16:47:37 +0200 Subject: [PATCH] dialect/sql/schema: keep the original name of pg index --- dialect/sql/schema/schema.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dialect/sql/schema/schema.go b/dialect/sql/schema/schema.go index a1df7111c..ef590853d 100644 --- a/dialect/sql/schema/schema.go +++ b/dialect/sql/schema/schema.go @@ -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