mysql script changed

This commit is contained in:
yedf2 2021-07-31 11:30:30 +08:00
parent 879eda00d8
commit b1edaf8e7f
2 changed files with 18 additions and 21 deletions

View File

@ -1,9 +1,7 @@
CREATE DATABASE IF NOT EXISTS `dtm` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
CREATE DATABASE IF NOT EXISTS dtm /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
use dtm;
drop table IF EXISTS trans_global;
CREATE TABLE if not EXISTS `trans_global` (
drop table IF EXISTS dtm.trans_global;
CREATE TABLE if not EXISTS dtm.trans_global (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gid` varchar(128) NOT NULL COMMENT '事务全局id',
`trans_type` varchar(45) not null COMMENT '事务类型: saga | xa',
@ -26,8 +24,8 @@ CREATE TABLE if not EXISTS `trans_global` (
key `next_cron_time` (`next_cron_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
drop table IF EXISTS trans_branch;
CREATE TABLE IF NOT EXISTS `trans_branch` (
drop table IF EXISTS dtm.trans_branch;
CREATE TABLE IF NOT EXISTS dtm.trans_branch (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gid` varchar(128) NOT NULL COMMENT '事务全局id',
`url` varchar(128) NOT NULL COMMENT '动作关联的url',
@ -45,8 +43,8 @@ CREATE TABLE IF NOT EXISTS `trans_branch` (
KEY `update_time` (`update_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
drop table IF EXISTS trans_log;
CREATE TABLE IF NOT EXISTS `trans_log` (
drop table IF EXISTS dtm.trans_log;
CREATE TABLE IF NOT EXISTS dtm.trans_log (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gid` varchar(128) NOT NULL COMMENT '事务全局id',
`branch_id` varchar(128) DEFAULT NULL COMMENT '事务分支',

View File

@ -1,7 +1,8 @@
CREATE DATABASE if not exists `dtm_busi` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
use dtm_busi;
drop table if exists user_account;
create table if not exists user_account(
CREATE DATABASE if not exists dtm_busi /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
create database if not exists dtm_barrier /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
drop table if exists dtm_busi.user_account;
create table if not exists dtm_busi.user_account(
id int(11) PRIMARY KEY AUTO_INCREMENT,
user_id int(11) UNIQUE ,
balance DECIMAL(10, 2) not null default '0',
@ -11,10 +12,10 @@ create table if not exists user_account(
key(update_time)
);
insert into user_account (user_id, balance) values (1, 10000), (2, 10000) on DUPLICATE KEY UPDATE balance=values (balance);
insert into dtm_busi.user_account (user_id, balance) values (1, 10000), (2, 10000) on DUPLICATE KEY UPDATE balance=values (balance);
drop table if exists user_account_trading;
create table if not exists user_account_trading( -- 表示交易中被冻结的金额
drop table if exists dtm_busi.user_account_trading;
create table if not exists dtm_busi.user_account_trading( -- 表示交易中被冻结的金额
id int(11) PRIMARY KEY AUTO_INCREMENT,
user_id int(11) UNIQUE ,
trading_balance DECIMAL(10, 2) not null default '0',
@ -24,13 +25,11 @@ create table if not exists user_account_trading( -- 表示交易中被冻结的
key(update_time)
);
insert into user_account_trading (user_id, trading_balance) values (1, 0), (2, 0) on DUPLICATE KEY UPDATE trading_balance=values (trading_balance);
insert into dtm_busi.user_account_trading (user_id, trading_balance) values (1, 0), (2, 0) on DUPLICATE KEY UPDATE trading_balance=values (trading_balance);
create database if not exists `dtm_barrier` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
use dtm_barrier;
drop table if exists barrier;
create table if not exists barrier(
drop table if exists dtm_barrier.barrier;
create table if not exists dtm_barrier.barrier(
id int(11) PRIMARY KEY AUTO_INCREMENT,
trans_type varchar(45) default '' ,
gid varchar(128) default'',