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 == "" {
detail = "{}"
}
db.Must().Table("test1.a_dtrans_log").Create(M{
db.Must().Table("trans_log").Create(M{
"gid": gid,
"action": action,
"status": status,

View File

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

View File

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