forked from dtm-labs/dtm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
359 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
create schema if not exists dtm_barrier; | ||
|
||
drop table if exists dtm_barrier.barrier; | ||
|
||
CREATE SEQUENCE if not EXISTS dtm_barrier.barrier_seq; | ||
|
||
create table if not exists dtm_barrier.barrier( | ||
id int NOT NULL DEFAULT NEXTVAL ('dtm_barrier.barrier_seq'), | ||
trans_type varchar(45) default '' , | ||
gid varchar(128) default'', | ||
branch_id varchar(128) default '', | ||
branch_type varchar(45) default '', | ||
barrier_id varchar(45) default '', | ||
reason varchar(45) default '', | ||
create_time timestamp(0) DEFAULT NULL, | ||
update_time timestamp(0) DEFAULT NULL, | ||
PRIMARY KEY(id), | ||
CONSTRAINT uniq_barrier unique(gid, branch_id, branch_type, barrier_id) | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
CREATE SCHEMA if not EXISTS dtm /* SQLINES DEMO *** RACTER SET utf8mb4 */; | ||
|
||
drop table IF EXISTS dtm.trans_global; | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
CREATE SEQUENCE if not EXISTS dtm.trans_global_seq; | ||
|
||
CREATE TABLE if not EXISTS dtm.trans_global ( | ||
id int NOT NULL DEFAULT NEXTVAL ('dtm.trans_global_seq'), | ||
gid varchar(128) NOT NULL , | ||
trans_type varchar(45) not null , | ||
status varchar(45) NOT NULL , | ||
query_prepared varchar(128) NOT NULL , | ||
protocol varchar(45) not null, | ||
create_time timestamp(0) DEFAULT NULL, | ||
update_time timestamp(0) DEFAULT NULL, | ||
commit_time timestamp(0) DEFAULT NULL, | ||
finish_time timestamp(0) DEFAULT NULL, | ||
rollback_time timestamp(0) DEFAULT NULL, | ||
next_cron_interval int default null , | ||
next_cron_time timestamp(0) default null , | ||
owner varchar(128) not null default '' , | ||
PRIMARY KEY (id), | ||
CONSTRAINT gid UNIQUE (gid) | ||
) ; | ||
|
||
create index if not EXISTS owner on dtm.trans_global(owner); | ||
CREATE INDEX if not EXISTS create_time ON dtm.trans_global (create_time); | ||
CREATE INDEX if not EXISTS update_time ON dtm.trans_global (update_time); | ||
create index if not EXISTS next_cron_time on dtm.trans_global (next_cron_time); | ||
|
||
drop table IF EXISTS dtm.trans_branch; | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
CREATE SEQUENCE if not EXISTS dtm.trans_branch_seq; | ||
|
||
CREATE TABLE IF NOT EXISTS dtm.trans_branch ( | ||
id int NOT NULL DEFAULT NEXTVAL ('dtm.trans_branch_seq'), | ||
gid varchar(128) NOT NULL , | ||
url varchar(128) NOT NULL , | ||
data TEXT , | ||
branch_id VARCHAR(128) NOT NULL , | ||
branch_type varchar(45) NOT NULL , | ||
status varchar(45) NOT NULL , | ||
finish_time timestamp(0) DEFAULT NULL, | ||
rollback_time timestamp(0) DEFAULT NULL, | ||
create_time timestamp(0) DEFAULT NULL, | ||
update_time timestamp(0) DEFAULT NULL, | ||
PRIMARY KEY (id), | ||
CONSTRAINT gid_uniq UNIQUE (gid,branch_id, branch_type) | ||
) ; | ||
|
||
CREATE INDEX if not EXISTS create_time ON dtm.trans_branch (create_time); | ||
CREATE INDEX if not EXISTS update_time ON dtm.trans_branch (update_time); | ||
|
||
drop table IF EXISTS dtm.trans_log; | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
CREATE SEQUENCE if not EXISTS dtm.trans_log_seq; | ||
|
||
CREATE TABLE IF NOT EXISTS dtm.trans_log ( | ||
id int NOT NULL DEFAULT NEXTVAL ('dtm.trans_log_seq'), | ||
gid varchar(128) NOT NULL , | ||
branch_id varchar(128) DEFAULT NULL , | ||
action varchar(45) DEFAULT NULL , | ||
old_status varchar(45) NOT NULL DEFAULT '' , | ||
new_status varchar(45) NOT NULL , | ||
detail TEXT NOT NULL , | ||
create_time timestamp(0) DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (id) | ||
) ; | ||
|
||
CREATE INDEX if not EXISTS gid ON dtm.trans_log (gid); | ||
CREATE INDEX if not EXISTS create_time ON dtm.trans_log (create_time); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
CREATE SCHEMA if not exists dtm_busi /* SQLINES DEMO *** RACTER SET utf8mb4 */; | ||
create SCHEMA if not exists dtm_barrier /* SQLINES DEMO *** RACTER SET utf8mb4 */; | ||
|
||
drop table if exists dtm_busi.user_account; | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create sequence if not exists dtm_busi.user_account_seq; | ||
|
||
create table if not exists dtm_busi.user_account( | ||
id int PRIMARY KEY DEFAULT NEXTVAL ('dtm_busi.user_account_seq'), | ||
user_id int UNIQUE , | ||
balance DECIMAL(10, 2) not null default '0', | ||
create_time timestamp(0) DEFAULT now(), | ||
update_time timestamp(0) DEFAULT now() | ||
); | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create index if not exists create_idx on dtm_busi.user_account(create_time); | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create index if not exists update_idx on dtm_busi.user_account(update_time); | ||
|
||
TRUNCATE dtm_busi.user_account; | ||
insert into dtm_busi.user_account (user_id, balance) values (1, 10000), (2, 10000); | ||
|
||
drop table if exists dtm_busi.user_account_trading; | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create sequence if not exists dtm_busi.user_account_trading_seq; | ||
|
||
create table if not exists dtm_busi.user_account_trading( -- SQLINES DEMO *** �冻结的金额 | ||
id int PRIMARY KEY DEFAULT NEXTVAL ('dtm_busi.user_account_trading_seq'), | ||
user_id int UNIQUE , | ||
trading_balance DECIMAL(10, 2) not null default '0', | ||
create_time timestamp(0) DEFAULT now(), | ||
update_time timestamp(0) DEFAULT now() | ||
); | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create index if not exists create_idx on dtm_busi.user_account_trading(create_time); | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create index if not exists update_idx on dtm_busi.user_account_trading(update_time); | ||
|
||
TRUNCATE dtm_busi.user_account_trading; | ||
insert into dtm_busi.user_account_trading (user_id, trading_balance) values (1, 0), (2, 0); | ||
|
||
|
||
drop table if exists dtm_barrier.barrier; | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create sequence if not exists dtm_barrier.barrier_seq; | ||
|
||
create table if not exists dtm_barrier.barrier( | ||
id int PRIMARY KEY DEFAULT NEXTVAL ('dtm_barrier.barrier_seq'), | ||
trans_type varchar(45) default '' , | ||
gid varchar(128) default'', | ||
branch_id varchar(128) default '', | ||
branch_type varchar(45) default '', | ||
reason varchar(45) default '' , | ||
result varchar(2047) default null , | ||
create_time timestamp(0) DEFAULT now(), | ||
update_time timestamp(0) DEFAULT now(), | ||
UNIQUE (gid, branch_id, branch_type) | ||
); | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create index if not exists create_idx on dtm_barrier.barrier(create_time); | ||
-- SQLINES LICENSE FOR EVALUATION USE ONLY | ||
create index if not exists update_idx on dtm_barrier.barrier(update_time); |
Oops, something went wrong.