diff --git a/dtmsvr/db.go b/dtmsvr/db.go index 57396bb..8fe9276 100644 --- a/dtmsvr/db.go +++ b/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, diff --git a/dtmsvr/dtm.yml.sample b/dtmsvr/dtmsvr.yml.sample similarity index 100% rename from dtmsvr/dtm.yml.sample rename to dtmsvr/dtmsvr.yml.sample diff --git a/dtmsvr/dtmsvr_test.go b/dtmsvr/dtmsvr_test.go index f61a42f..4a8225a 100644 --- a/dtmsvr/dtmsvr_test.go +++ b/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() diff --git a/dtmsvr/types.go b/dtmsvr/types.go index bcf4bef..735203e 100644 --- a/dtmsvr/types.go +++ b/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{}