|
|
@ -7,8 +7,7 @@ import (
|
|
|
|
"github.com/tal-tech/go-zero/core/stores/sqlx"
|
|
|
|
"github.com/tal-tech/go-zero/core/stores/sqlx"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var p2m = map[string]string{
|
|
|
|
p2m = map[string]string{
|
|
|
|
|
|
|
|
"int8": "bigint",
|
|
|
|
"int8": "bigint",
|
|
|
|
"numeric": "bigint",
|
|
|
|
"numeric": "bigint",
|
|
|
|
"float8": "double",
|
|
|
|
"float8": "double",
|
|
|
@ -16,7 +15,6 @@ var (
|
|
|
|
"int2": "smallint",
|
|
|
|
"int2": "smallint",
|
|
|
|
"int4": "integer",
|
|
|
|
"int4": "integer",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PostgreSqlModel gets table information from information_schema、pg_catalog
|
|
|
|
// PostgreSqlModel gets table information from information_schema、pg_catalog
|
|
|
|
type PostgreSqlModel struct {
|
|
|
|
type PostgreSqlModel struct {
|
|
|
@ -173,7 +171,7 @@ func (m *PostgreSqlModel) getIndex(schema, table string) (map[string][]*DbIndex,
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var index = make(map[string][]*DbIndex)
|
|
|
|
index := make(map[string][]*DbIndex)
|
|
|
|
for _, e := range indexes {
|
|
|
|
for _, e := range indexes {
|
|
|
|
if e.IsPrimary.Bool {
|
|
|
|
if e.IsPrimary.Bool {
|
|
|
|
index[e.ColumnName.String] = append(index[e.ColumnName.String], &DbIndex{
|
|
|
|
index[e.ColumnName.String] = append(index[e.ColumnName.String], &DbIndex{
|
|
|
|