bistoury building a database built form (a)

bistoury

 

DROP TABLE
IF EXISTS bistoury_app;

The CREATE TABLE bistoury_app
(
ID the INT UNSIGNED AUTO_INCREMENT a PRIMARY KEY,
code VARCHAR (50) the DEFAULT '' the NOT NULL the COMMENT 'application code',
name VARCHAR (50) the DEFAULT '' the NOT NULL the COMMENT 'application name',
Group_Code VARCHAR (50) the DEFAULT ' 'nOT NULL COMMENT' belonging group coding ',
status TINYINT the DEFAULT 0 the nOT NULL the COMMENT' application state, 0 = unapproved, 1 = approved, 2 = review is denied, 3 = obsolete ',
Creator VARCHAR (50) the DEFAULT' 'NOT NULL COMMENT' creator ',
the create_time the COMMENT TIMESTAMP the DEFAULT CURRENT_TIMESTAMP the NOT NULL' created ',
CONSTRAINT uniq_code UNIQUE (CODE)
) charset = utf8mb4;

DROP TABLE
IF EXISTS bistoury_user_app;

CREATE TABLE bistoury_user_app
(
id INT UNSIGNED auto_increment PRIMARY KEY,
app_code VARCHAR(50) NOT NULL COMMENT '应用代号',
user_code VARCHAR(50) NOT NULL COMMENT '用户标识',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
CONSTRAINT uniq_app_user UNIQUE (
app_code,
user_code
)
) charset = utf8mb4;

CREATE INDEX idx_app_code ON bistoury_user_app (app_code);

CREATE INDEX idx_user_code ON bistoury_user_app (user_code);

DROP TABLE
IF EXISTS bistoury_server;

The CREATE TABLE bistoury_server
(
ID BIGINT (. 11) UNSIGNED AUTO_INCREMENT the COMMENT 'master key' a PRIMARY KEY,
the server_id VARCHAR (32) default '' Not null Comment 'Server ID',
IP VARCHAR (15) the DEFAULT '' the NOT NULL the COMMENT 'Server IP',
Port the INT UNSIGNED the DEFAULT 0 the NOT NULL the COMMENT 'Server Port',
Host VARCHAR (100) the DEFAULT '' the NOT NULL the COMMENT 'Server Host',
LOG_DIR VARCHAR (255) the DEFAULT '' the NOT NULL the COMMENT 'Server log directory',
Room VARCHAR (20 is ) dEFAULT '' NOT nULL COMMENT ' server room',
App_Code VARCHAR (50) default '' Not null Comment 'corresponding AppCode',
auto_jstack_enable tinyint default 0 Not null Comment 'automatically jstack open state: 0 is off, 1 is ON' ,
auto_jmap_histo_enable tinyint default 0 not null comment 'opens automatically jmap histo Status: 0 is off, 1 is ON',
index idx_server_app_code (app_code),
constraint uniq_server_id unique (server_id),
CONSTRAINT uniq_ip UNIQUE (ip)
) charset = utf8mb4;

DROP TABLE IF EXISTS `bistoury_gitlab_token`;
CREATE TABLE `bistoury_gitlab_token`
(
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_code` varchar(50) NOT NULL DEFAULT '' COMMENT '用户code',
`private_token` varchar(100) NOT NULL DEFAULT '' COMMENT 'gitlab private token',
`create_time` timestamp NOT NULL DEFAULT '1970-01-01 08:00:01' COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_git_user_code` (`user_code`)
) CHARSET = utf8mb4;

DROP TABLE if exists `bistoury_user`;
create table `bistoury_user`(
id int unsigned auto_increment comment '主键' primary key ,
user_code varchar(50) not null default '' comment '用户code',
password varchar(100) not null default '' comment '用户密码',
constraint uniq_user_code unique (user_code)
)CHARSET = utf8mb4;

 

 

insert into bistoury_user (user_code, password) values ('admin','q1mHvT20zskSnIHSF27d/A==');
insert into bistoury_app(code, name, group_code, status, creator) values ('bistoury_demo_app','测试应用','tcdev',1,'admin');
insert into bistoury_user_app (app_code, user_code) values ('bistoury_demo_app','admin');
insert into bistoury_server (server_id, ip, port, host, log_dir, room, app_code, auto_jstack_enable, auto_jmap_histo_enable) values ('bade8ba7d59b4ca0b91a044739a670aa','${local_ip}',8080,'${local_host}','${log_dir}','al','bistoury_demo_app',1,0);

Guess you like

Origin www.cnblogs.com/longxok/p/11512626.html