iptv/models/mysql.ddl.sql
2025-07-16 15:07:06 +08:00

506 lines
18 KiB
SQL

-- ./iptvchannels.xlsx
drop table if exists iptvchannels;
CREATE TABLE iptvchannels
(
`id` VARCHAR(32) comment '编号',
`tv_group` VARCHAR(500) comment '频道组',
`tv_name` VARCHAR(500) comment '频道名称',
`logo_url` VARCHAR(1000) comment '台标url',
`url` VARCHAR(1000) comment 'url',
`media_type` VARCHAR(100) comment '媒体类型',
`download_date` VARCHAR(10) comment '下载日期',
`channel_delay` int comment '频道延迟',
`channel_grade` int comment '频道等级',
`del_flg` VARCHAR(1) comment '删除标志'
,primary key(id)
)
engine=innodb
default charset=utf8
comment 'IPTV频道清单'
;
CREATE INDEX iptvchannels_idx1 ON iptvchannels(tv_group);
CREATE INDEX iptvchannels_idx2 ON iptvchannels(tv_name);
CREATE UNIQUE INDEX iptvchannels_idx3 ON iptvchannels(url);
-- ./userapikey.xlsx
drop table if exists userapikey;
CREATE TABLE userapikey
(
`id` VARCHAR(32) comment 'id',
`providerid` VARCHAR(200) comment '供应商id',
`customerid` VARCHAR(32) DEFAULT '0' comment '用户id',
`apikey` VARCHAR(4000) DEFAULT '0' comment 'api密钥',
`secretkey` VARCHAR(4000) comment '附属密钥',
`rfname` VARCHAR(400) comment '函数名'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '用户api密码表'
;
CREATE UNIQUE INDEX userapikey_idx1 ON userapikey(providerid,customerid);
CREATE INDEX userapikey_idx2 ON userapikey(customerid);
-- ./userroles.xlsx
drop table if exists userrole;
CREATE TABLE userrole
(
`id` VARCHAR(32) comment '用户id',
`userid` VARCHAR(32) comment '用户id',
`roleid` VARCHAR(32) comment '角色id'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '用户角色'
;
-- ./appcodes_kv.xlsx
drop table if exists appcodes_kv;
CREATE TABLE appcodes_kv
(
`id` VARCHAR(32) comment 'id',
`parentid` VARCHAR(32) comment '父id',
`k` VARCHAR(32) comment '',
`v` VARCHAR(255) comment ''
,primary key(id)
)
engine=innodb
default charset=utf8
comment '编码键值表'
;
CREATE UNIQUE INDEX appcodes_kv_idx1 ON appcodes_kv(parentid,k);
CREATE INDEX appcodes_kv_idx2 ON appcodes_kv(parentid);
insert into appcodes_kv (id,parentid,k,v) values ('code0001','resp_mode','0','stream');
insert into appcodes_kv (id,parentid,k,v) values ('code0002','resp_mode','1','sync');
insert into appcodes_kv (id,parentid,k,v) values ('code0003','resp_mode','2','async');
insert into appcodes_kv (id,parentid,k,v) values ('code0004','params_type','0','model');
insert into appcodes_kv (id,parentid,k,v) values ('code0005','params_type','1','modelinstance');
insert into appcodes_kv (id,parentid,k,v) values ('code0006','params_type','2','user');
insert into appcodes_kv (id,parentid,k,v) values ('code0007','params_type','3','session');
insert into appcodes_kv (id,parentid,k,v) values ('code0008','code_hierarchy','0','one l');
insert into appcodes_kv (id,parentid,k,v) values ('code0009','code_hierarchy','1','hierarchy');
insert into appcodes_kv (id,parentid,k,v) values ('code0010','minimax_acc_status','0','enabled');
insert into appcodes_kv (id,parentid,k,v) values ('code0011','minimax_acc_status','2','disabled');
insert into appcodes_kv (id,parentid,k,v) values ('code0012','datatype','str','str');
insert into appcodes_kv (id,parentid,k,v) values ('code0013','datatype','char','char');
insert into appcodes_kv (id,parentid,k,v) values ('code0014','datatype','short','short');
insert into appcodes_kv (id,parentid,k,v) values ('code0015','datatype','long','long');
insert into appcodes_kv (id,parentid,k,v) values ('code0016','datatype','llong','llong');
insert into appcodes_kv (id,parentid,k,v) values ('code0017','datatype','date','date');
insert into appcodes_kv (id,parentid,k,v) values ('code0018','datatype','time','time');
insert into appcodes_kv (id,parentid,k,v) values ('code0019','datatype','timestamp','timestamp');
insert into appcodes_kv (id,parentid,k,v) values ('code0020','datatype','float','float');
insert into appcodes_kv (id,parentid,k,v) values ('code0021','datatype','double','double');
insert into appcodes_kv (id,parentid,k,v) values ('code0022','datatype','ddouble','ddouble');
insert into appcodes_kv (id,parentid,k,v) values ('code0023','datatype','decimal','decimal');
insert into appcodes_kv (id,parentid,k,v) values ('code0024','uitype','str','str');
insert into appcodes_kv (id,parentid,k,v) values ('code0025','uitype','text','text');
insert into appcodes_kv (id,parentid,k,v) values ('code0026','uitype','date','date');
insert into appcodes_kv (id,parentid,k,v) values ('code0027','uitype','int','int');
insert into appcodes_kv (id,parentid,k,v) values ('code0028','uitype','float','float');
insert into appcodes_kv (id,parentid,k,v) values ('code0029','uitype','file','file');
insert into appcodes_kv (id,parentid,k,v) values ('code0030','uitype','email','email');
insert into appcodes_kv (id,parentid,k,v) values ('code0031','uitype','tel','tel');
insert into appcodes_kv (id,parentid,k,v) values ('code0032','uitype','audiotext','audiotext');
insert into appcodes_kv (id,parentid,k,v) values ('code0033','uitype','password','password');
insert into appcodes_kv (id,parentid,k,v) values ('code0034','uitype','checkbox','checkbox');
insert into appcodes_kv (id,parentid,k,v) values ('code0035','uitype','check','check');
insert into appcodes_kv (id,parentid,k,v) values ('code0036','uitype','code','code');
insert into appcodes_kv (id,parentid,k,v) values ('code0037','yesno','1','yes');
insert into appcodes_kv (id,parentid,k,v) values ('code0038','yesno','0','no');
insert into appcodes_kv (id,parentid,k,v) values ('code0039','org_type','0','personal');
insert into appcodes_kv (id,parentid,k,v) values ('code0040','org_type','1','organization');
-- ./appcodes.xlsx
drop table if exists appcodes;
CREATE TABLE appcodes
(
`id` VARCHAR(32) comment 'id',
`name` VARCHAR(255) comment '编码名称',
`hierarchy_flg` VARCHAR(1) comment '多级标志'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '应用编码表'
;
insert into appcodes (id,name,hierarchy_flg) values ('resp_mode','返回模式','0');
insert into appcodes (id,name,hierarchy_flg) values ('params_type','参数类型','0');
insert into appcodes (id,name,hierarchy_flg) values ('code_hierarchy','编码层次','0');
insert into appcodes (id,name,hierarchy_flg) values ('minimax_acc_status','minimax账户状态','0');
insert into appcodes (id,name,hierarchy_flg) values ('datatype','数据类型','0');
insert into appcodes (id,name,hierarchy_flg) values ('uitype','UI类型','0');
insert into appcodes (id,name,hierarchy_flg) values ('yesno','是否选项','0');
insert into appcodes (id,name,hierarchy_flg) values ('org_type','机构类型','0');
-- ./userdepartment.xlsx
drop table if exists userdepartment;
CREATE TABLE userdepartment
(
`id` VARCHAR(32) comment 'id',
`userid` VARCHAR(32) comment '用户id',
`depid` VARCHAR(32) comment '部门id',
`del_flg` VARCHAR(1) DEFAULT '0' comment '删除标志',
`create_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间戳'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '用户部门表'
;
-- ./tags.xlsx
drop table if exists tags;
CREATE TABLE tags
(
`id` VARCHAR(32) comment 'id',
`userid` VARCHAR(32) comment '用户id',
`tag` VARCHAR(400) comment '标签名称'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '标签表'
;
-- ./userapp.xlsx
drop table if exists userapp;
CREATE TABLE userapp
(
`id` VARCHAR(32) comment 'id',
`userid` VARCHAR(32) DEFAULT '0' comment '用户id',
`appname` VARCHAR(99) comment '应用名称',
`apikey` VARCHAR(400) comment 'apikey'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '用户应用'
;
-- ./permission.xlsx
drop table if exists permission;
CREATE TABLE permission
(
`id` VARCHAR(32) comment '权限id',
`name` VARCHAR(255) comment '名称',
`description` VARCHAR(255) comment '描述',
`ptype` VARCHAR(20) comment '类型',
`parentid` VARCHAR(32) comment '父权限id',
`path` VARCHAR(255) comment '路径',
`title` VARCHAR(255) comment '标题',
`icon` VARCHAR(255) comment '图标'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '权限'
;
CREATE INDEX permission_idx1 ON permission(ptype);
CREATE INDEX permission_idx2 ON permission(parentid);
-- ./taging.xlsx
drop table if exists taging;
CREATE TABLE taging
(
`id` VARCHAR(32) comment 'id',
`channelid` VARCHAR(32) comment '频道id',
`tagid` VARCHAR(32) comment '标签id'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '打标签'
;
-- ./device.xlsx
drop table if exists device;
CREATE TABLE device
(
`id` VARCHAR(32) comment 'id',
`name` VARCHAR(255) comment '设备名称',
`takeover_flg` VARCHAR(1) comment '接管标志',
`userid` VARCHAR(32) comment '用户id'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '设备表'
;
-- ./users.xlsx
drop table if exists users;
CREATE TABLE users
(
`id` VARCHAR(32) comment '用户id',
`username` VARCHAR(255) comment '用户名',
`name` VARCHAR(255) comment '姓名',
`password` VARCHAR(255) comment '密码',
`email` VARCHAR(255) comment '邮件地址',
`orgid` VARCHAR(32) comment '所属机构',
`nick_name` VARCHAR(255) comment '显示名',
`address` VARCHAR(255) comment '地址',
`mobile` VARCHAR(255) comment '手机',
`user_status` VARCHAR(1) DEFAULT '0' comment '用户状态'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '用户'
;
CREATE INDEX users_idx1 ON users(orgid);
CREATE UNIQUE INDEX users_idx2 ON users(username);
insert into users (id,username,password) values (' HappyCat123',' HappyCat123','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GreenForest456',' GreenForest456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SunnySky789',' SunnySky789','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' OceanWave246',' OceanWave246','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' BraveLion135',' BraveLion135','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' MagicStar987',' MagicStar987','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' HappyFox654',' HappyFox654','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' RedSunshine321',' RedSunshine321','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' BlueMoon852',' BlueMoon852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' WiseOwl963',' WiseOwl963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SilverCloud741',' SilverCloud741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GoldenEagle258',' GoldenEagle258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' QuickTiger369',' QuickTiger369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SmartBear147',' SmartBear147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GentleBreeze852',' GentleBreeze852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' FlyingHawk753',' FlyingHawk753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' LuckyFish159',' LuckyFish159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' BrightStar246',' BrightStar246','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' BoldWolf789',' BoldWolf789','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' ShinyGem963',' ShinyGem963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' PeacefulDove357',' PeacefulDove357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' NobleKnight456',' NobleKnight456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' CleverRabbit852',' CleverRabbit852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' MysticRiver159',' MysticRiver159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SilentSnow753',' SilentSnow753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' JoyfulBird369',' JoyfulBird369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' StrongBull258',' StrongBull258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' CalmSea147',' CalmSea147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' HonestSheep963',' HonestSheep963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' PlayfulPuppy357',' PlayfulPuppy357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GlowingSun147',' GlowingSun147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SweetCherry456',' SweetCherry456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' DreamySky852',' DreamySky852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' FriendlyDuck963',' FriendlyDuck963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' KindElephant741',' KindElephant741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' HappyWhale258',' HappyWhale258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GracefulSwan159',' GracefulSwan159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' BraveEagle753',' BraveEagle753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GentleRabbit369',' GentleRabbit369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SunnyMeadow852',' SunnyMeadow852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' WiseLion147',' WiseLion147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SilverMountain456',' SilverMountain456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' MysticMoon852',' MysticMoon852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' ShinyStar963',' ShinyStar963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' PeacefulTree357',' PeacefulTree357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GoldenRiver741',' GoldenRiver741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' BoldHawk258',' BoldHawk258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' BrightLeaf159',' BrightLeaf159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SmartPanda753',' SmartPanda753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' SilentOcean369',' SilentOcean369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' LuckyBear852',' LuckyBear852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' QuickFox147',' QuickFox147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' HappyDeer456',' HappyDeer456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GreenValley852',' GreenValley852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' CalmRiver963',' CalmRiver963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' HonestHawk357',' HonestHawk357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' PlayfulCat147',' PlayfulCat147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GlowingStar456',' GlowingStar456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' FriendlySheep852',' FriendlySheep852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' NobleFox963',' NobleFox963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' DreamyWhale741',' DreamyWhale741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' KindDove258',' KindDove258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
insert into users (id,username,password) values (' GentleBear159',' GentleBear159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A==');
-- ./channelfailed.xlsx
drop table if exists channelfailed;
CREATE TABLE channelfailed
(
`id` VARCHAR(32) comment 'id',
`deviceid` VARCHAR(32) comment '设备id',
`channelid` VARCHAR(32) comment '频道id',
`reporttime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '报告时间'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '频道播放失败'
;
-- ./playhistory.xlsx
drop table if exists playhistory;
CREATE TABLE playhistory
(
`id` VARCHAR(32) comment 'id',
`deviceid` VARCHAR(32) comment '设备id',
`channelid` VARCHAR(32) comment '频道id',
`playtime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '开始时间'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '播放历史'
;