Forráskód Böngészése

修改automigrate接口

yjp 1 éve
szülő
commit
0d7b25b388
2 módosított fájl, 6 hozzáadás és 17 törlés
  1. 1 10
      client/client_cmd_request.go
  2. 5 7
      test/v1/v1_test.go

+ 1 - 10
client/client_cmd_request.go

@@ -11,7 +11,7 @@ type AutoMigrateBatchRequest struct {
 type AutoMigrateItem struct {
 	TablePrefixWithSchema string
 	Version               string
-	TableModelDescribe    TableModelDescribe
+	TableModelDescribe    map[string]string
 }
 
 type InsertRequest struct {
@@ -74,12 +74,3 @@ type ReplayRequest struct {
 	KeyValues             map[string]string
 	UserID                string
 }
-
-type TableModelDescribe struct {
-	Fields []TableModelField `json:"fields"`
-}
-
-type TableModelField struct {
-	Name string `json:"name"`
-	Tag  string `json:"tag"`
-}

+ 5 - 7
test/v1/v1_test.go

@@ -8,13 +8,11 @@ import (
 	"time"
 )
 
-var tableModelDescribe = client.TableModelDescribe{
-	Fields: []client.TableModelField{
-		{"ID", "gorm:\"primary_key;type:varchar(32);comment:id;\""},
-		{"Name", "gorm:\"not null;type:varchar(128);comment:数据库名称;\""},
-		{"Time", "gorm:\"not null;type:timestamp with time zone;comment:数据库时间;\""},
-		{"TableNum", "gorm:\"not null;type:integer;comment:数据库表数量;\""},
-	},
+var tableModelDescribe = map[string]string{
+	"ID":       "gorm:\"primary_key;type:varchar(32);comment:id;\"",
+	"Name":     "gorm:\"not null;type:varchar(128);comment:数据库名称;\"",
+	"Time":     "gorm:\"not null;type:timestamp with time zone;comment:数据库时间;\"",
+	"TableNum": "gorm:\"not null;type:integer;comment:数据库表数量;\"",
 }
 
 func TestAutoMigrate(t *testing.T) {