rename table

This commit is contained in:
yedongfu 2021-05-21 15:19:37 +08:00
parent 7e8de22d1e
commit dff343b64d
4 changed files with 8 additions and 8 deletions

View File

@ -49,7 +49,7 @@ func writeTransLog(gid string, action string, status string, step int, detail st
if detail == "" { if detail == "" {
detail = "{}" detail = "{}"
} }
db.Must().Table("test1.a_dtrans_log").Create(M{ db.Must().Table("trans_log").Create(M{
"gid": gid, "gid": gid,
"action": action, "action": action,
"status": status, "status": status,

View File

@ -32,9 +32,9 @@ var myinit int = func() int {
func TestDtmSvr(t *testing.T) { func TestDtmSvr(t *testing.T) {
SagaProcessedTestChan = make(chan string, 1) SagaProcessedTestChan = make(chan string, 1)
// 清理数据 // 清理数据
common.PanicIfError(db.Exec("truncate test1.a_saga").Error) common.PanicIfError(db.Exec("truncate saga").Error)
common.PanicIfError(db.Exec("truncate test1.a_saga_step").Error) common.PanicIfError(db.Exec("truncate saga_step").Error)
common.PanicIfError(db.Exec("truncate test1.a_dtrans_log").Error) common.PanicIfError(db.Exec("truncate trans_log").Error)
// 启动组件 // 启动组件
go StartSvr() go StartSvr()

View File

@ -4,6 +4,8 @@ import (
"time" "time"
) )
type M = map[string]interface{}
type ModelBase struct { type ModelBase struct {
ID uint ID uint
CreateTime time.Time `gorm:"autoCreateTime"` CreateTime time.Time `gorm:"autoCreateTime"`
@ -20,7 +22,7 @@ type SagaModel struct {
} }
func (*SagaModel) TableName() string { func (*SagaModel) TableName() string {
return "test1.a_saga" return "saga"
} }
type SagaStepModel struct { type SagaStepModel struct {
@ -36,7 +38,5 @@ type SagaStepModel struct {
} }
func (*SagaStepModel) TableName() string { func (*SagaStepModel) TableName() string {
return "test1.a_saga_step" return "saga_step"
} }
type M = map[string]interface{}