mirror of https://github.com/go-gorm/gorm.git
Fix postgres primary key sql tag
This commit is contained in:
parent
e6a2273114
commit
1e6be1646e
|
@ -45,9 +45,9 @@ func (d *postgres) SqlTag(column interface{}, size int) string {
|
||||||
func (s *postgres) PrimaryKeyTag(column interface{}, size int) string {
|
func (s *postgres) PrimaryKeyTag(column interface{}, size int) string {
|
||||||
switch column.(type) {
|
switch column.(type) {
|
||||||
case int, int8, int16, int32, uint, uint8, uint16, uint32:
|
case int, int8, int16, int32, uint, uint8, uint16, uint32:
|
||||||
return "serial"
|
return "serial PRIMARY KEY"
|
||||||
case int64, uint64:
|
case int64, uint64:
|
||||||
return "bigserial"
|
return "bigserial PRIMARY KEY"
|
||||||
default:
|
default:
|
||||||
panic("Invalid primary key type")
|
panic("Invalid primary key type")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue