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

8
dtmsvr/types.go

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

Loading…
Cancel
Save