Jelajahi Sumber

添加批量创建表的接口

yjp 1 tahun lalu
induk
melakukan
b99a4f3314

+ 26 - 0
dpsv1/client.go

@@ -71,6 +71,32 @@ func (c *Client) AutoMigrate(req *ports.AutoMigrateRequest) error {
 	return nil
 }
 
+func (c *Client) AutoMigrateBatch(req *ports.AutoMigrateBatchRequest) error {
+	items := make([]*request.AutoMigrateItem, 0)
+	for _, reqItem := range req.Items {
+		tableModelDescribeJsonBytes, err := json.Marshal(reqItem.TableModelDescribe)
+		if err != nil {
+			return err
+		}
+
+		items = append(items, &request.AutoMigrateItem{
+			TablePrefixWithSchema: reqItem.TablePrefixWithSchema,
+			Version:               reqItem.Version,
+			TableModelDescribe:    tableModelDescribeJsonBytes,
+		})
+	}
+
+	_, err := c.commandServiceClient.AutoMigrateBatch(context.Background(), &request.AutoMigrateBatchRequest{
+		DatabaseID: req.DatabaseID,
+		Items:      items,
+	})
+	if err != nil {
+		return err
+	}
+
+	return nil
+}
+
 func (c *Client) Transaction(databaseID string, txFunc ports.TransactionFunc) error {
 	stream, err := c.commandServiceClient.Transaction(context.Background())
 	if err != nil {

+ 2 - 2
dpsv1/transaction.go

@@ -24,7 +24,7 @@ func (tx *Transaction) InsertTx(req *ports.InsertRequest) (string, error) {
 		}
 	}()
 
-	reqTableRowMap, err := tx.client.formTableRow(req.TableRow)
+	reqTableRow, err := tx.client.formTableRow(req.TableRow)
 	if err != nil {
 		return "", err
 	}
@@ -36,7 +36,7 @@ func (tx *Transaction) InsertTx(req *ports.InsertRequest) (string, error) {
 				TablePrefixWithSchema: req.TablePrefixWithSchema,
 				Version:               req.Version,
 				KeyColumns:            req.KeyColumns,
-				TableRow:              reqTableRowMap,
+				TableRow:              reqTableRow,
 				UserID:                req.UserID,
 			},
 		}})

+ 39 - 31
pb/v1/command.pb.go

@@ -31,12 +31,17 @@ var file_v1_command_proto_rawDesc = []byte{
 	0x1a, 0x19, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2f, 0x63, 0x6f,
 	0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f,
 	0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70,
-	0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xf2, 0x04, 0x0a, 0x0e, 0x43, 0x6f, 0x6d,
+	0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xc2, 0x05, 0x0a, 0x0e, 0x43, 0x6f, 0x6d,
 	0x6d, 0x61, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x41,
 	0x75, 0x74, 0x6f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1b, 0x2e, 0x72, 0x65, 0x71,
 	0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65,
 	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
 	0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,
+	0x00, 0x12, 0x4e, 0x0a, 0x10, 0x41, 0x75, 0x74, 0x6f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65,
+	0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x20, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e,
+	0x41, 0x75, 0x74, 0x6f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68,
+	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+	0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,
 	0x00, 0x12, 0x56, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
 	0x12, 0x1d, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73,
 	0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a,
@@ -77,38 +82,41 @@ var file_v1_command_proto_rawDesc = []byte{
 
 var file_v1_command_proto_goTypes = []interface{}{
 	(*request.AutoMigrateRequest)(nil),        // 0: request.AutoMigrateRequest
-	(*request.TransactionOperation)(nil),      // 1: request.TransactionOperation
-	(*request.InsertRequest)(nil),             // 2: request.InsertRequest
-	(*request.InsertBatchRequest)(nil),        // 3: request.InsertBatchRequest
-	(*request.DeleteRequest)(nil),             // 4: request.DeleteRequest
-	(*request.DeleteBatchRequest)(nil),        // 5: request.DeleteBatchRequest
-	(*request.UpdateRequest)(nil),             // 6: request.UpdateRequest
-	(*request.ReplayRequest)(nil),             // 7: request.ReplayRequest
-	(*empty.Empty)(nil),                       // 8: google.protobuf.Empty
-	(*response.CommandStatementResponse)(nil), // 9: response.CommandStatementResponse
+	(*request.AutoMigrateBatchRequest)(nil),   // 1: request.AutoMigrateBatchRequest
+	(*request.TransactionOperation)(nil),      // 2: request.TransactionOperation
+	(*request.InsertRequest)(nil),             // 3: request.InsertRequest
+	(*request.InsertBatchRequest)(nil),        // 4: request.InsertBatchRequest
+	(*request.DeleteRequest)(nil),             // 5: request.DeleteRequest
+	(*request.DeleteBatchRequest)(nil),        // 6: request.DeleteBatchRequest
+	(*request.UpdateRequest)(nil),             // 7: request.UpdateRequest
+	(*request.ReplayRequest)(nil),             // 8: request.ReplayRequest
+	(*empty.Empty)(nil),                       // 9: google.protobuf.Empty
+	(*response.CommandStatementResponse)(nil), // 10: response.CommandStatementResponse
 }
 var file_v1_command_proto_depIdxs = []int32{
-	0, // 0: v1.CommandService.AutoMigrate:input_type -> request.AutoMigrateRequest
-	1, // 1: v1.CommandService.Transaction:input_type -> request.TransactionOperation
-	2, // 2: v1.CommandService.Insert:input_type -> request.InsertRequest
-	3, // 3: v1.CommandService.InsertBatch:input_type -> request.InsertBatchRequest
-	4, // 4: v1.CommandService.Delete:input_type -> request.DeleteRequest
-	5, // 5: v1.CommandService.DeleteBatch:input_type -> request.DeleteBatchRequest
-	6, // 6: v1.CommandService.Update:input_type -> request.UpdateRequest
-	7, // 7: v1.CommandService.Replay:input_type -> request.ReplayRequest
-	8, // 8: v1.CommandService.AutoMigrate:output_type -> google.protobuf.Empty
-	9, // 9: v1.CommandService.Transaction:output_type -> response.CommandStatementResponse
-	9, // 10: v1.CommandService.Insert:output_type -> response.CommandStatementResponse
-	9, // 11: v1.CommandService.InsertBatch:output_type -> response.CommandStatementResponse
-	9, // 12: v1.CommandService.Delete:output_type -> response.CommandStatementResponse
-	9, // 13: v1.CommandService.DeleteBatch:output_type -> response.CommandStatementResponse
-	9, // 14: v1.CommandService.Update:output_type -> response.CommandStatementResponse
-	9, // 15: v1.CommandService.Replay:output_type -> response.CommandStatementResponse
-	8, // [8:16] is the sub-list for method output_type
-	0, // [0:8] is the sub-list for method input_type
-	0, // [0:0] is the sub-list for extension type_name
-	0, // [0:0] is the sub-list for extension extendee
-	0, // [0:0] is the sub-list for field type_name
+	0,  // 0: v1.CommandService.AutoMigrate:input_type -> request.AutoMigrateRequest
+	1,  // 1: v1.CommandService.AutoMigrateBatch:input_type -> request.AutoMigrateBatchRequest
+	2,  // 2: v1.CommandService.Transaction:input_type -> request.TransactionOperation
+	3,  // 3: v1.CommandService.Insert:input_type -> request.InsertRequest
+	4,  // 4: v1.CommandService.InsertBatch:input_type -> request.InsertBatchRequest
+	5,  // 5: v1.CommandService.Delete:input_type -> request.DeleteRequest
+	6,  // 6: v1.CommandService.DeleteBatch:input_type -> request.DeleteBatchRequest
+	7,  // 7: v1.CommandService.Update:input_type -> request.UpdateRequest
+	8,  // 8: v1.CommandService.Replay:input_type -> request.ReplayRequest
+	9,  // 9: v1.CommandService.AutoMigrate:output_type -> google.protobuf.Empty
+	9,  // 10: v1.CommandService.AutoMigrateBatch:output_type -> google.protobuf.Empty
+	10, // 11: v1.CommandService.Transaction:output_type -> response.CommandStatementResponse
+	10, // 12: v1.CommandService.Insert:output_type -> response.CommandStatementResponse
+	10, // 13: v1.CommandService.InsertBatch:output_type -> response.CommandStatementResponse
+	10, // 14: v1.CommandService.Delete:output_type -> response.CommandStatementResponse
+	10, // 15: v1.CommandService.DeleteBatch:output_type -> response.CommandStatementResponse
+	10, // 16: v1.CommandService.Update:output_type -> response.CommandStatementResponse
+	10, // 17: v1.CommandService.Replay:output_type -> response.CommandStatementResponse
+	9,  // [9:18] is the sub-list for method output_type
+	0,  // [0:9] is the sub-list for method input_type
+	0,  // [0:0] is the sub-list for extension type_name
+	0,  // [0:0] is the sub-list for extension extendee
+	0,  // [0:0] is the sub-list for field type_name
 }
 
 func init() { file_v1_command_proto_init() }

+ 36 - 0
pb/v1/command_grpc.pb.go

@@ -26,6 +26,7 @@ const _ = grpc.SupportPackageIsVersion7
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
 type CommandServiceClient interface {
 	AutoMigrate(ctx context.Context, in *request.AutoMigrateRequest, opts ...grpc.CallOption) (*empty.Empty, error)
+	AutoMigrateBatch(ctx context.Context, in *request.AutoMigrateBatchRequest, opts ...grpc.CallOption) (*empty.Empty, error)
 	Transaction(ctx context.Context, opts ...grpc.CallOption) (CommandService_TransactionClient, error)
 	Insert(ctx context.Context, in *request.InsertRequest, opts ...grpc.CallOption) (*response.CommandStatementResponse, error)
 	InsertBatch(ctx context.Context, in *request.InsertBatchRequest, opts ...grpc.CallOption) (*response.CommandStatementResponse, error)
@@ -52,6 +53,15 @@ func (c *commandServiceClient) AutoMigrate(ctx context.Context, in *request.Auto
 	return out, nil
 }
 
+func (c *commandServiceClient) AutoMigrateBatch(ctx context.Context, in *request.AutoMigrateBatchRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
+	out := new(empty.Empty)
+	err := c.cc.Invoke(ctx, "/v1.CommandService/AutoMigrateBatch", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *commandServiceClient) Transaction(ctx context.Context, opts ...grpc.CallOption) (CommandService_TransactionClient, error) {
 	stream, err := c.cc.NewStream(ctx, &CommandService_ServiceDesc.Streams[0], "/v1.CommandService/Transaction", opts...)
 	if err != nil {
@@ -142,6 +152,7 @@ func (c *commandServiceClient) Replay(ctx context.Context, in *request.ReplayReq
 // for forward compatibility
 type CommandServiceServer interface {
 	AutoMigrate(context.Context, *request.AutoMigrateRequest) (*empty.Empty, error)
+	AutoMigrateBatch(context.Context, *request.AutoMigrateBatchRequest) (*empty.Empty, error)
 	Transaction(CommandService_TransactionServer) error
 	Insert(context.Context, *request.InsertRequest) (*response.CommandStatementResponse, error)
 	InsertBatch(context.Context, *request.InsertBatchRequest) (*response.CommandStatementResponse, error)
@@ -159,6 +170,9 @@ type UnimplementedCommandServiceServer struct {
 func (UnimplementedCommandServiceServer) AutoMigrate(context.Context, *request.AutoMigrateRequest) (*empty.Empty, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method AutoMigrate not implemented")
 }
+func (UnimplementedCommandServiceServer) AutoMigrateBatch(context.Context, *request.AutoMigrateBatchRequest) (*empty.Empty, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method AutoMigrateBatch not implemented")
+}
 func (UnimplementedCommandServiceServer) Transaction(CommandService_TransactionServer) error {
 	return status.Errorf(codes.Unimplemented, "method Transaction not implemented")
 }
@@ -211,6 +225,24 @@ func _CommandService_AutoMigrate_Handler(srv interface{}, ctx context.Context, d
 	return interceptor(ctx, in, info, handler)
 }
 
+func _CommandService_AutoMigrateBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(request.AutoMigrateBatchRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(CommandServiceServer).AutoMigrateBatch(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/v1.CommandService/AutoMigrateBatch",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(CommandServiceServer).AutoMigrateBatch(ctx, req.(*request.AutoMigrateBatchRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _CommandService_Transaction_Handler(srv interface{}, stream grpc.ServerStream) error {
 	return srv.(CommandServiceServer).Transaction(&commandServiceTransactionServer{stream})
 }
@@ -356,6 +388,10 @@ var CommandService_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "AutoMigrate",
 			Handler:    _CommandService_AutoMigrate_Handler,
 		},
+		{
+			MethodName: "AutoMigrateBatch",
+			Handler:    _CommandService_AutoMigrateBatch_Handler,
+		},
 		{
 			MethodName: "Insert",
 			Handler:    _CommandService_Insert_Handler,

File diff ditekan karena terlalu besar
+ 430 - 290
pb/v1/request/command.pb.go


+ 28 - 0
pb/v1/request/command.validator.pb.go

@@ -31,6 +31,34 @@ func (this *AutoMigrateRequest) Validate() error {
 	}
 	return nil
 }
+func (this *AutoMigrateBatchRequest) Validate() error {
+	if this.DatabaseID == "" {
+		return github_com_mwitkow_go_proto_validators.FieldError("DatabaseID", fmt.Errorf(`value '%v' must not be an empty string`, this.DatabaseID))
+	}
+	if len(this.Items) < 1 {
+		return github_com_mwitkow_go_proto_validators.FieldError("Items", fmt.Errorf(`value '%v' must contain at least 1 elements`, this.Items))
+	}
+	for _, item := range this.Items {
+		if item != nil {
+			if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
+				return github_com_mwitkow_go_proto_validators.FieldError("Items", err)
+			}
+		}
+	}
+	return nil
+}
+func (this *AutoMigrateItem) Validate() error {
+	if this.TablePrefixWithSchema == "" {
+		return github_com_mwitkow_go_proto_validators.FieldError("TablePrefixWithSchema", fmt.Errorf(`value '%v' must not be an empty string`, this.TablePrefixWithSchema))
+	}
+	if this.Version == "" {
+		return github_com_mwitkow_go_proto_validators.FieldError("Version", fmt.Errorf(`value '%v' must not be an empty string`, this.Version))
+	}
+	if !(len(this.TableModelDescribe) > 0) {
+		return github_com_mwitkow_go_proto_validators.FieldError("TableModelDescribe", fmt.Errorf(`value '%v' must have a length greater than '0'`, this.TableModelDescribe))
+	}
+	return nil
+}
 func (this *TransactionOperation) Validate() error {
 	if oneOfNester, ok := this.GetRequest().(*TransactionOperation_TransactionBeginRequest); ok {
 		if oneOfNester.TransactionBeginRequest != nil {

+ 1 - 0
ports/client.go

@@ -14,6 +14,7 @@ const (
 
 type Client interface {
 	AutoMigrate(request *AutoMigrateRequest) error
+	AutoMigrateBatch(request *AutoMigrateBatchRequest) error
 	Transaction(databaseID string, txFunc TransactionFunc) error
 	Insert(request *InsertRequest) (string, error)
 	InsertBatch(request *InsertBatchRequest) (string, error)

+ 10 - 3
ports/client_cmd_request.go

@@ -1,14 +1,21 @@
 package ports
 
 type AutoMigrateRequest struct {
-	DatabaseID            string
+	DatabaseID string
+	AutoMigrateItem
+}
+
+type AutoMigrateBatchRequest struct {
+	DatabaseID string
+	Items      []AutoMigrateItem
+}
+
+type AutoMigrateItem struct {
 	TablePrefixWithSchema string
 	Version               string
 	TableModelDescribe    TableModelDescribe
 }
 
-// TODO 事务
-
 type InsertRequest struct {
 	DatabaseID            string
 	TablePrefixWithSchema string

+ 9 - 0
test/v1/sdk.go

@@ -45,6 +45,15 @@ func (toolKit *ToolKit) autoMigrate(req *ports.AutoMigrateRequest) *ToolKit {
 	return toolKit
 }
 
+func (toolKit *ToolKit) autoMigrateBatch(req *ports.AutoMigrateBatchRequest) *ToolKit {
+	err := clientInstance.AutoMigrateBatch(req)
+	if err != nil {
+		toolKit.t.Fatal(err)
+	}
+
+	return toolKit
+}
+
 func (toolKit *ToolKit) transaction(databaseID string, txFunc ports.TransactionFunc) *ToolKit {
 	err := clientInstance.Transaction(databaseID, txFunc)
 	if err != nil {

+ 67 - 38
test/v1/v1_test.go

@@ -21,12 +21,25 @@ func TestAutoMigrate(t *testing.T) {
 	initClient(t, "localhost:30170")
 	defer destroyClient(t)
 
-	newToolKit(t).autoMigrate(&ports.AutoMigrateRequest{
-		DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-		TablePrefixWithSchema: "test." + simpleUUID()[0:8],
-		Version:               "v1",
-		TableModelDescribe:    tableModelDescribe,
-	})
+	newToolKit(t).
+		autoMigrate(&ports.AutoMigrateRequest{
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: "test." + simpleUUID()[0:8],
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
+		}).
+		autoMigrateBatch(&ports.AutoMigrateBatchRequest{
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			Items: []ports.AutoMigrateItem{
+				{
+					TablePrefixWithSchema: "test." + simpleUUID()[0:8],
+					Version:               "v1",
+					TableModelDescribe:    tableModelDescribe,
+				},
+			},
+		})
 }
 
 func TestTransaction(t *testing.T) {
@@ -48,10 +61,12 @@ func TestTransaction(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		transaction("2b78141779ee432295ca371b91c5cac7", func(tx ports.Transaction) error {
 			statement, err := tx.InsertTx(&ports.InsertRequest{
@@ -203,10 +218,12 @@ func TestTransactionBatch(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		transaction("2b78141779ee432295ca371b91c5cac7", func(tx ports.Transaction) error {
 			statement, err := tx.InsertBatchTx(&ports.InsertBatchRequest{
@@ -343,10 +360,12 @@ func TestInsert(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		insert(&ports.InsertRequest{
 			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
@@ -393,10 +412,12 @@ func TestInsertBatch(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		insertBatch(&ports.InsertBatchRequest{
 			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
@@ -480,10 +501,12 @@ func TestUpdate(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		insert(&ports.InsertRequest{
 			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
@@ -538,10 +561,12 @@ func TestDelete(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		insert(&ports.InsertRequest{
 			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
@@ -598,10 +623,12 @@ func TestDeleteBatch(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		insertBatch(&ports.InsertBatchRequest{
 			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
@@ -670,10 +697,12 @@ func TestReply(t *testing.T) {
 
 	newToolKit(t).
 		autoMigrate(&ports.AutoMigrateRequest{
-			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",
-			TablePrefixWithSchema: tablePrefix,
-			Version:               "v1",
-			TableModelDescribe:    tableModelDescribe,
+			DatabaseID: "2b78141779ee432295ca371b91c5cac7",
+			AutoMigrateItem: ports.AutoMigrateItem{
+				TablePrefixWithSchema: tablePrefix,
+				Version:               "v1",
+				TableModelDescribe:    tableModelDescribe,
+			},
 		}).
 		insert(&ports.InsertRequest{
 			DatabaseID:            "2b78141779ee432295ca371b91c5cac7",

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini