From 2c34d4474a21a5a43c5bf4580dbafa23e940fb56 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 14 Aug 2021 10:04:09 +0800 Subject: [PATCH] Fix test --- dialects/postgres.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dialects/postgres.go b/dialects/postgres.go index 0ff7d875..5fdaeeba 100644 --- a/dialects/postgres.go +++ b/dialects/postgres.go @@ -981,17 +981,17 @@ func (db *postgres) CreateTableSQL(table *schemas.Table, tableName string) ([]st s, _ := ColumnString(db, col, col.IsPrimaryKey && len(table.PrimaryKeys) == 1) b.WriteString(s) - if len(table.PrimaryKeys) > 1 { - b.WriteString("PRIMARY KEY ( ") - b.WriteString(quoter.Join(table.PrimaryKeys, ",")) - b.WriteString(" )") - } - if i != len(table.ColumnsSeq())-1 { b.WriteString(", ") } } + if len(table.PrimaryKeys) > 1 { + b.WriteString(", PRIMARY KEY (") + b.WriteString(quoter.Join(table.PrimaryKeys, ",")) + b.WriteString(")") + } + b.WriteString(")") return []string{b.String()}, false