From 7470e1fe8ea4ee316a1f76fb18e93d63df1686b7 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 1 Feb 2023 15:37:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/update.sql | 3 - .../genersoft/iot/vmp/conf/FlywayConfig.java | 57 +++ .../migration/V1.0_20230118__初始化脚本.sql | 373 ------------------ .../db/migration/V2.6.7_20230201__初始化.sql | 0 4 files changed, 57 insertions(+), 376 deletions(-) delete mode 100644 sql/update.sql create mode 100644 src/main/java/com/genersoft/iot/vmp/conf/FlywayConfig.java delete mode 100644 src/main/resources/db/migration/V1.0_20230118__初始化脚本.sql rename sql/mysql.sql => src/main/resources/db/migration/V2.6.7_20230201__初始化.sql (100%) diff --git a/sql/update.sql b/sql/update.sql deleted file mode 100644 index 2e5d5691..00000000 --- a/sql/update.sql +++ /dev/null @@ -1,3 +0,0 @@ --- 2.6.6->2.6.7 -alter table device - add keepaliveIntervalTime int default null; \ No newline at end of file diff --git a/src/main/java/com/genersoft/iot/vmp/conf/FlywayConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/FlywayConfig.java new file mode 100644 index 00000000..b73acb94 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/conf/FlywayConfig.java @@ -0,0 +1,57 @@ +package com.genersoft.iot.vmp.conf; + +import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.FlywayException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; +import javax.sql.DataSource; + +/** + * 数据库自动升级脚本 + */ +@Configuration +public class FlywayConfig { + + private final static Logger logger = LoggerFactory.getLogger(FlywayConfig.class); + + @Autowired + private DataSource dataSource; + + @PostConstruct + public void migrate() { + Flyway flyway = Flyway.configure() + .dataSource(dataSource) + .locations("db/migration")//sql文件名称规则:"V20210625.17.30__V1.0.sql" + // 自动创建flyway元数据表标识 + .baselineOnMigrate(true) + .baselineVersion("0") + // 禁止flyway执行清理 + .cleanDisabled(true) + .table("flyway_schema_history_wvp") + // 对于开发环境, 可能是多人协作开发, 很可能先 apply 了自己本地的最新 SQL 代码, 然后发现其他同事早先时候提交的 SQL 代码还没有 apply, + // 所以 开发环境应该设置 spring.flyway.outOfOrder=true, 这样 flyway 将能加载漏掉的老版本 SQL 文件; + // 而生产环境应该设置 spring.flyway.outOfOrder=false + .outOfOrder(true) + .encoding("UTF-8") + .load(); + try { + flyway.migrate(); + } catch (FlywayException e) { + logger.error("[数据库自动升级]配置第一次加载出错", e); + try { + flyway.repair();//生成版本记录表 + logger.info("[数据库自动升级]配置修复成功"); + flyway.migrate(); + logger.info("[数据库自动升级]配置重新加载成功"); + } catch (Exception e1) { + logger.error("[数据库自动升级]配置第二次加载出错", e1); + throw e1; + } + } + } + +} diff --git a/src/main/resources/db/migration/V1.0_20230118__初始化脚本.sql b/src/main/resources/db/migration/V1.0_20230118__初始化脚本.sql deleted file mode 100644 index f40e8c16..00000000 --- a/src/main/resources/db/migration/V1.0_20230118__初始化脚本.sql +++ /dev/null @@ -1,373 +0,0 @@ -/* - Navicat Premium Data Transfer - - Source Server : mysql.jtcl.top - Source Server Type : MySQL - Source Server Version : 80028 (8.0.28) - Source Host : mysql.jtcl.top:3306 - Source Schema : wvp2 - - Target Server Type : MySQL - Target Server Version : 80028 (8.0.28) - File Encoding : 65001 - - Date: 18/01/2023 15:02:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for device --- ---------------------------- -DROP TABLE IF EXISTS `device`; -CREATE TABLE `device` ( - `id` int NOT NULL AUTO_INCREMENT, - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `firmware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `streamMode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `port` int NULL DEFAULT NULL, - `expires` int NULL DEFAULT NULL, - `subscribeCycleForCatalog` int NULL DEFAULT NULL, - `hostAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `charset` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `subscribeCycleForMobilePosition` int NULL DEFAULT NULL, - `mobilePositionSubmissionInterval` int NULL DEFAULT 5, - `subscribeCycleForAlarm` int NULL DEFAULT NULL, - `ssrcCheck` int NULL DEFAULT 0, - `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `custom_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `localIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `keepaliveIntervalTime` int NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `device_deviceId_uindex`(`deviceId` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Table structure for device_alarm --- ---------------------------- -DROP TABLE IF EXISTS `device_alarm`; -CREATE TABLE `device_alarm` ( - `id` int NOT NULL AUTO_INCREMENT, - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `longitude` double NULL DEFAULT NULL, - `latitude` double NULL DEFAULT NULL, - `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for device_channel --- ---------------------------- -DROP TABLE IF EXISTS `device_channel`; -CREATE TABLE `device_channel` ( - `id` int NOT NULL AUTO_INCREMENT, - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `safetyWay` int NULL DEFAULT NULL, - `registerWay` int NULL DEFAULT NULL, - `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `certifiable` int NULL DEFAULT NULL, - `errCode` int NULL DEFAULT NULL, - `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `port` int NULL DEFAULT NULL, - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `PTZType` int NULL DEFAULT NULL, - `status` int NULL DEFAULT NULL, - `longitude` double NULL DEFAULT NULL, - `latitude` double NULL DEFAULT NULL, - `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `hasAudio` bit(1) NULL DEFAULT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `subCount` int NULL DEFAULT 0, - `longitudeGcj02` double NULL DEFAULT NULL, - `latitudeGcj02` double NULL DEFAULT NULL, - `longitudeWgs84` double NULL DEFAULT NULL, - `latitudeWgs84` double NULL DEFAULT NULL, - `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `gpsTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `device_channel_id_uindex`(`id` ASC) USING BTREE, - UNIQUE INDEX `device_channel_pk`(`channelId` ASC, `deviceId` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Table structure for device_mobile_position --- ---------------------------- -DROP TABLE IF EXISTS `device_mobile_position`; -CREATE TABLE `device_mobile_position` ( - `id` int NOT NULL AUTO_INCREMENT, - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `longitude` double NOT NULL, - `latitude` double NOT NULL, - `altitude` double NULL DEFAULT NULL, - `speed` double NULL DEFAULT NULL, - `direction` double NULL DEFAULT NULL, - `reportSource` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `longitudeGcj02` double NULL DEFAULT NULL, - `latitudeGcj02` double NULL DEFAULT NULL, - `longitudeWgs84` double NULL DEFAULT NULL, - `latitudeWgs84` double NULL DEFAULT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Table structure for gb_stream --- ---------------------------- -DROP TABLE IF EXISTS `gb_stream`; -CREATE TABLE `gb_stream` ( - `gbStreamId` int NOT NULL AUTO_INCREMENT, - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `gbId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `longitude` double NULL DEFAULT NULL, - `latitude` double NULL DEFAULT NULL, - `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`gbStreamId`) USING BTREE, - UNIQUE INDEX `app`(`app` ASC, `stream` ASC) USING BTREE, - UNIQUE INDEX `gbId`(`gbId` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for log --- ---------------------------- -DROP TABLE IF EXISTS `log`; -CREATE TABLE `log` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `result` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `timing` bigint NOT NULL, - `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 976 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for media_server --- ---------------------------- -DROP TABLE IF EXISTS `media_server`; -CREATE TABLE `media_server` ( - `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `hookIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `streamIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `httpPort` int NOT NULL, - `httpSSlPort` int NOT NULL, - `rtmpPort` int NOT NULL, - `rtmpSSlPort` int NOT NULL, - `rtpProxyPort` int NOT NULL, - `rtspPort` int NOT NULL, - `rtspSSLPort` int NOT NULL, - `autoConfig` int NOT NULL, - `secret` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `rtpEnable` int NOT NULL, - `rtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `recordAssistPort` int NOT NULL, - `defaultServer` int NOT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `hookAliveInterval` int NOT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `media_server_i`(`ip` ASC, `httpPort` ASC) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for parent_platform --- ---------------------------- -DROP TABLE IF EXISTS `parent_platform`; -CREATE TABLE `parent_platform` ( - `id` int NOT NULL AUTO_INCREMENT, - `enable` int NULL DEFAULT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `serverGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `serverGBDomain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `serverIP` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `serverPort` int NULL DEFAULT NULL, - `deviceGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `deviceIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `devicePort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `expires` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `keepTimeout` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `characterSet` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `ptz` int NULL DEFAULT NULL, - `rtcp` int NULL DEFAULT NULL, - `status` bit(1) NULL DEFAULT NULL, - `startOfflinePush` int NULL DEFAULT 0, - `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `catalogGroup` int NULL DEFAULT 1, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `parent_platform_id_uindex`(`id` ASC) USING BTREE, - UNIQUE INDEX `parent_platform_pk`(`serverGBId` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for platform_catalog --- ---------------------------- -DROP TABLE IF EXISTS `platform_catalog`; -CREATE TABLE `platform_catalog` ( - `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for platform_gb_channel --- ---------------------------- -DROP TABLE IF EXISTS `platform_gb_channel`; -CREATE TABLE `platform_gb_channel` ( - `id` int NOT NULL AUTO_INCREMENT, - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `deviceChannelId` int NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Table structure for platform_gb_stream --- ---------------------------- -DROP TABLE IF EXISTS `platform_gb_stream`; -CREATE TABLE `platform_gb_stream` ( - `id` int NOT NULL AUTO_INCREMENT, - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `gbStreamId` int NOT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `platform_gb_stream_pk`(`platformId` ASC, `catalogId` ASC, `gbStreamId` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for stream_proxy --- ---------------------------- -DROP TABLE IF EXISTS `stream_proxy`; -CREATE TABLE `stream_proxy` ( - `id` int NOT NULL AUTO_INCREMENT, - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `src_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `dst_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `timeout_ms` int NULL DEFAULT NULL, - `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `enable_audio` bit(1) NULL DEFAULT NULL, - `enable_mp4` bit(1) NULL DEFAULT NULL, - `enable` bit(1) NOT NULL, - `status` bit(1) NOT NULL, - `enable_remove_none_reader` bit(1) NOT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `enable_disable_none_reader` bit(1) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `stream_proxy_pk`(`app` ASC, `stream` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Table structure for stream_push --- ---------------------------- -DROP TABLE IF EXISTS `stream_push`; -CREATE TABLE `stream_push` ( - `id` int NOT NULL AUTO_INCREMENT, - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `originType` int NULL DEFAULT NULL, - `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `aliveSecond` int NULL DEFAULT NULL, - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `serverId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `pushTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `status` int NULL DEFAULT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `pushIng` int NULL DEFAULT NULL, - `self` int NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `stream_push_pk`(`app` ASC, `stream` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `id` int NOT NULL AUTO_INCREMENT, - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `roleId` int NOT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `pushKey` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `user_username_uindex`(`username` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Table structure for user_role --- ---------------------------- -DROP TABLE IF EXISTS `user_role`; -CREATE TABLE `user_role` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/sql/mysql.sql b/src/main/resources/db/migration/V2.6.7_20230201__初始化.sql similarity index 100% rename from sql/mysql.sql rename to src/main/resources/db/migration/V2.6.7_20230201__初始化.sql