RuoYi-Vue-Plus/ruoyi-site/ruoyi-h5/doc/init.sql
2026-03-17 14:47:54 +08:00

193 lines
10 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

create table file_metadata_info
(
id bigint auto_increment comment '主键'
primary key,
file_key varchar(50) not null comment '文件KEY',
file_md5 varchar(50) null comment '文件md5',
file_name varchar(255) not null comment '文件名',
file_mime_type varchar(128) null comment 'MIME类型',
file_suffix varchar(20) null comment '文件后缀',
file_size bigint null comment '文件大小',
is_preview tinyint(1) default 0 null comment '预览图 0:无 1:有',
is_private tinyint(1) default 0 null comment '是否私有 0:否 1:是',
bucket varchar(20) not null comment '存储桶',
bucket_path varchar(20) not null comment '存储桶路径',
upload_id varchar(255) null comment '上传任务id',
is_finished tinyint(1) default 0 not null comment '状态 0:未完成 1:已完成',
is_part tinyint(1) null comment '是否分块 0:否 1:是',
part_number int(4) null comment '分块数量',
create_time datetime not null comment '创建时间',
create_user varchar(255) not null comment '创建用户',
update_time datetime not null on update CURRENT_TIMESTAMP comment '更新时间',
update_user varchar(255) not null comment '更新用户'
)
comment '文件元数据信息表' charset = utf8mb4
row_format = DYNAMIC;
create index INDEX_KEY
on file_metadata_info (file_key);
create index INDEX_MD5
on file_metadata_info (file_md5);
create table h5_project
(
id bigint auto_increment comment '主键ID'
primary key,
type varchar(50) not null comment '类型',
title varchar(255) not null comment '标题',
content json not null comment '项目内容JSON格式',
content_updated_at bigint null comment '内容更新时间戳',
description varchar(500) null comment '描述',
preview_url varchar(500) null comment '预览图URL',
preview_url_watermark varchar(500) null comment '水印预览图URL',
preview_width int not null comment '预览图宽度',
preview_height int not null comment '预览图高度',
status tinyint(2) default 1 not null comment '状态1草稿2已发布',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间戳',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间戳',
deleted tinyint(1) default 0 not null comment '是否删除',
created_by bigint not null comment '创建人',
td bigint not null comment '租户id-1表示无租户的概念'
)
comment 'H5项目表' charset = utf8mb4;
create fulltext index ft_title
on h5_project (title);
create table h5_font
(
id bigint auto_increment comment '主键ID'
primary key,
source varchar(50) not null comment '字体来源',
name varchar(255) not null comment '字体名称',
preview json not null comment '预览JSON格式',
lang varchar(10) not null comment '字体语言类型zh-中文en-英文',
alias varchar(255) not null comment '字体别名',
content json not null comment '字体内容JSON格式',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间戳',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间戳',
constraint uk_name
unique (name) comment '字体族名称唯一索引'
)
comment '字体表' charset = utf8mb4
row_format = DYNAMIC;
create index idx_lang
on h5_font (lang)
comment '语言类型索引';
create index idx_name
on h5_font (name)
comment '字体名称索引';
create table h5_form_submission
(
id bigint auto_increment comment '主键ID'
primary key,
project_id bigint null comment 'H5Project的ID',
templet_form_id bigint null comment '模板表单ID',
form_id bigint null comment '表单ID',
ip_address varchar(50) null comment '提交者IP地址',
user_agent varchar(512) null comment '用户代理信息',
form_data json not null comment '表单数据JSON格式存储',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间戳',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间戳',
created_by bigint null comment '创建人'
)
comment '表单提交记录表' charset = utf8mb4;
create index idx_project_id
on h5_form_submission (project_id);
create index idx_templet_form_id
on h5_form_submission (templet_form_id);
create table h5_form
(
id bigint auto_increment comment '主键ID'
primary key,
name varchar(255) null comment '表单名称',
templet_id bigint null comment '模板ID',
content_form_id varchar(50) null comment '内容表单ID',
form_id varchar(50) null comment '表单ID',
auth json null comment '认证信息',
extends json null comment '扩展信息',
fields json null comment '字段信息',
deleted tinyint(1) default 0 not null comment '是否删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间戳',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间戳',
created_by bigint null comment '创建人'
)
comment 'H5表单定义表' charset = utf8mb4;
create index idx_templet_id
on h5_form (templet_id);
create table h5_group
(
id bigint auto_increment comment '主键ID'
primary key,
name varchar(100) not null comment '分组名称',
parent_id bigint default 0 not null comment '父级分组ID0表示一级分组',
type int not null comment '分组类型1-物料 2-用途 3-行业',
sort int default 0 not null comment '排序',
status int default 1 not null comment '状态0-禁用 1-启用',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间戳',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间戳'
)
comment 'H5分组表' charset = utf8mb4
row_format = DYNAMIC;
create index idx_parent_id
on h5_group (parent_id);
create index idx_type
on h5_group (type);
create table h5_project
(
id bigint auto_increment comment '主键ID'
primary key,
type varchar(50) not null comment '类型',
title varchar(255) not null comment '标题',
content json null comment '项目内容JSON格式',
content_updated_at bigint null comment '内容更新时间戳',
description varchar(500) null comment '描述',
preview_url varchar(500) null comment '预览图URL',
preview_url_watermark varchar(500) null comment '水印预览图URL',
preview_width int not null comment '预览图宽度',
preview_height int not null comment '预览图高度',
status tinyint not null comment '状态',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间戳',
update_time datetime null on update CURRENT_TIMESTAMP comment '更新时间戳',
deleted tinyint(1) default 0 not null comment '是否删除',
created_by bigint not null comment '创建人',
td bigint not null comment '租户id'
)
comment 'H5项目表' charset = utf8mb4
row_format = DYNAMIC;
create fulltext index ft_title
on h5_project (title);
create table h5_project_group
(
id bigint auto_increment comment '主键ID'
primary key,
project_id bigint not null comment '项目ID',
group_id bigint not null comment '分组ID',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间戳'
)
comment 'H5项目与分组关联表' charset = utf8mb4
row_format = DYNAMIC;
create index idx_group_id
on h5_project_group (group_id);
create index idx_project_id
on h5_project_group (project_id);