Browse Source

rename table

pull/6/head
yedongfu 5 years ago
parent
commit
dff343b64d
  1. 2
      dtmsvr/db.go
  2. 0
      dtmsvr/dtmsvr.yml.sample
  3. 6
      dtmsvr/dtmsvr_test.go
  4. 8
      dtmsvr/types.go

2
dtmsvr/db.go

@ -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,

0
dtmsvr/dtm.yml.sample → dtmsvr/dtmsvr.yml.sample

6
dtmsvr/dtmsvr_test.go

@ -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()

8
dtmsvr/types.go

@ -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{}

Loading…
Cancel
Save