This commit is contained in:
Lunny Xiao 2021-08-14 10:04:09 +08:00
parent eef20a33b9
commit 2c34d4474a
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 6 additions and 6 deletions

View File

@ -981,17 +981,17 @@ func (db *postgres) CreateTableSQL(table *schemas.Table, tableName string) ([]st
s, _ := ColumnString(db, col, col.IsPrimaryKey && len(table.PrimaryKeys) == 1) s, _ := ColumnString(db, col, col.IsPrimaryKey && len(table.PrimaryKeys) == 1)
b.WriteString(s) 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 { if i != len(table.ColumnsSeq())-1 {
b.WriteString(", ") b.WriteString(", ")
} }
} }
if len(table.PrimaryKeys) > 1 {
b.WriteString(", PRIMARY KEY (")
b.WriteString(quoter.Join(table.PrimaryKeys, ","))
b.WriteString(")")
}
b.WriteString(")") b.WriteString(")")
return []string{b.String()}, false return []string{b.String()}, false