优化mysql建库脚本

This commit is contained in:
panlinlin 2021-04-27 15:38:00 +08:00
parent 2046b40acc
commit 3916c9bbd1

View File

@ -3,79 +3,79 @@ create schema wvp collate utf8_bin;
create table device create table device
( (
deviceId varchar(255) not null deviceId varchar(50) not null
primary key, primary key,
name varchar(255) null, name varchar(50) null,
manufacturer varchar(255) null, manufacturer varchar(50) null,
model varchar(255) null, model varchar(50) null,
firmware varchar(255) null, firmware varchar(50) null,
transport varchar(255) null, transport varchar(50) null,
streamMode varchar(255) null, streamMode varchar(50) null,
online varchar(255) null, online varchar(50) null,
registerTimeMillis int null, registerTimeMillis int null,
ip varchar(255) not null, ip varchar(50) not null,
port int not null, port int not null,
hostAddress varchar(255) not null hostAddress varchar(50) not null
); );
create table device_channel create table device_channel
( (
channelId varchar(255) not null, channelId varchar(50) not null,
name varchar(255) null, name varchar(50) null,
manufacture varchar(255) null, manufacture varchar(50) null,
model varchar(255) null, model varchar(50) null,
owner varchar(255) null, owner varchar(50) null,
civilCode varchar(255) null, civilCode varchar(50) null,
block varchar(255) null, block varchar(50) null,
address varchar(255) null, address varchar(50) null,
parentId varchar(255) null, parentId varchar(50) null,
safetyWay int null, safetyWay int null,
registerWay int null, registerWay int null,
certNum varchar(255) null, certNum varchar(50) null,
certifiable int null, certifiable int null,
errCode int null, errCode int null,
endTime varchar(255) null, endTime varchar(50) null,
secrecy varchar(255) null, secrecy varchar(50) null,
ipAddress varchar(255) null, ipAddress varchar(50) null,
port int null, port int null,
password varchar(255) null, password varchar(50) null,
PTZType int null, PTZType int null,
status int null, status int null,
longitude double null, longitude double null,
latitude double null, latitude double null,
streamId varchar(255) null, streamId varchar(50) null,
deviceId varchar(255) not null, deviceId varchar(50) not null,
parental varchar(255) null, parental varchar(50) null,
hasAudio tinyint(1) null, hasAudio tinyint(1) null,
primary key (channelId, deviceId) primary key (channelId, deviceId)
); );
create table device_mobile_position create table device_mobile_position
( (
deviceId varchar(255) not null, deviceId varchar(50) not null,
deviceName varchar(255) null, deviceName varchar(50) null,
time varchar(255) not null, time varchar(50) not null,
longitude double not null, longitude double not null,
latitude double not null, latitude double not null,
altitude double null, altitude double null,
speed double null, speed double null,
direction double null, direction double null,
reportSource varchar(255) null, reportSource varchar(50) null,
geodeticSystem varchar(255) null, geodeticSystem varchar(50) null,
cnLng varchar(255) null, cnLng varchar(50) null,
cnLat varchar(255) null, cnLat varchar(50) null,
primary key (deviceId, time) primary key (deviceId, time)
); );
create table gb_stream create table gb_stream
( (
app varchar(255) not null, app varchar(50) not null,
stream varchar(255) not null, stream varchar(50) not null,
gbId varchar(255) not null, gbId varchar(50) not null,
name varchar(255) null, name varchar(50) null,
longitude double null, longitude double null,
latitude double null, latitude double null,
streamType varchar(255) null, streamType varchar(50) null,
status int null, status int null,
primary key (app, stream, gbId) primary key (app, stream, gbId)
); );
@ -83,21 +83,21 @@ create table gb_stream
create table parent_platform create table parent_platform
( (
enable int null, enable int null,
name varchar(255) null, name varchar(50) null,
serverGBId varchar(255) not null serverGBId varchar(50) not null
primary key, primary key,
serverGBDomain varchar(255) null, serverGBDomain varchar(50) null,
serverIP varchar(255) null, serverIP varchar(50) null,
serverPort int null, serverPort int null,
deviceGBId varchar(255) not null, deviceGBId varchar(50) not null,
deviceIp varchar(255) null, deviceIp varchar(50) null,
devicePort varchar(255) null, devicePort varchar(50) null,
username varchar(255) null, username varchar(50) null,
password varchar(255) null, password varchar(50) null,
expires varchar(255) null, expires varchar(50) null,
keepTimeout varchar(255) null, keepTimeout varchar(50) null,
transport varchar(255) null, transport varchar(50) null,
characterSet varchar(255) null, characterSet varchar(50) null,
ptz int null, ptz int null,
rtcp int null, rtcp int null,
status tinyint(1) null status tinyint(1) null
@ -105,32 +105,32 @@ create table parent_platform
create table platform_gb_channel create table platform_gb_channel
( (
channelId varchar(255) not null, channelId varchar(50) not null,
deviceId varchar(255) not null, deviceId varchar(50) not null,
platformId varchar(255) not null, platformId varchar(50) not null,
deviceAndChannelId varchar(255) not null, deviceAndChannelId varchar(50) not null,
primary key (deviceAndChannelId, platformId) primary key (deviceAndChannelId, platformId)
); );
create table platform_gb_stream create table platform_gb_stream
( (
platformId varchar(255) not null, platformId varchar(50) not null,
app varchar(255) not null, app varchar(50) not null,
stream varchar(255) not null, stream varchar(50) not null,
primary key (platformId, app, stream) primary key (platformId, app, stream)
); );
create table stream_proxy create table stream_proxy
( (
type varchar(255) not null, type varchar(50) not null,
app varchar(255) not null, app varchar(50) not null,
stream varchar(255) not null, stream varchar(50) not null,
url varchar(255) null, url varchar(50) null,
src_url varchar(255) null, src_url varchar(50) null,
dst_url blob null, dst_url blob null,
timeout_ms int null, timeout_ms int null,
ffmpeg_cmd_key varchar(255) null, ffmpeg_cmd_key varchar(50) null,
rtp_type varchar(255) null, rtp_type varchar(50) null,
enable_hls tinyint(1) null, enable_hls tinyint(1) null,
enable_mp4 tinyint(1) null, enable_mp4 tinyint(1) null,
enable tinyint(1) not null, enable tinyint(1) not null,
@ -139,11 +139,11 @@ create table stream_proxy
create table stream_push create table stream_push
( (
app varchar(255) not null, app varchar(50) not null,
stream varchar(255) not null, stream varchar(50) not null,
totalReaderCount varchar(255) null, totalReaderCount varchar(50) null,
originType int null, originType int null,
originTypeStr varchar(255) null, originTypeStr varchar(50) null,
createStamp int null, createStamp int null,
aliveSecond int null, aliveSecond int null,
primary key (app, stream) primary key (app, stream)
@ -153,10 +153,10 @@ create table user
( (
id int auto_increment id int auto_increment
primary key, primary key,
username varchar(255) not null, username varchar(50) not null,
password varchar(255) not null, password varchar(50) not null,
roleId int not null, roleId int not null,
create_time varchar(255) not null create_time varchar(50) not null
); );
insert into user (username, password, roleId, create_time) values ('admin', '21232f297a57a5a743894a0e4a801fc3', '0', '2021-04-13 14:14:57'); insert into user (username, password, roleId, create_time) values ('admin', '21232f297a57a5a743894a0e4a801fc3', '0', '2021-04-13 14:14:57');