加入flyway管理数据库版本;后端有字段变动或数据迁移时请使用flyway!!

This commit is contained in:
wangliwen 2022-06-14 16:05:27 +08:00
parent 3f88a03a8f
commit a63f63bb66
6 changed files with 1912 additions and 0 deletions

View File

@ -39,6 +39,7 @@
<system.linux-x86_64>linux-x86_64</system.linux-x86_64> <system.linux-x86_64>linux-x86_64</system.linux-x86_64>
<ffmpeg.version>5.0</ffmpeg.version> <ffmpeg.version>5.0</ffmpeg.version>
<okhttp.version>3.14.9</okhttp.version> <okhttp.version>3.14.9</okhttp.version>
<flyway-core.version>8.5.12</flyway-core.version>
<java.version>1.8</java.version> <java.version>1.8</java.version>
</properties> </properties>
@ -262,6 +263,17 @@
<version>${okhttp.version}</version> <version>${okhttp.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-core -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<!-- javacv+javacpp核心库--> <!-- javacv+javacpp核心库-->
<dependency> <dependency>

View File

@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -103,6 +104,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired @Autowired
private SysDeptDao sysDeptDao; private SysDeptDao sysDeptDao;
@Lazy
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;

View File

@ -51,6 +51,10 @@ spring:
check-process-definitions: false check-process-definitions: false
resources: resources:
static-locations: classpath:/static,classpath:/public,file:${resource.path} static-locations: classpath:/static,classpath:/public,file:${resource.path}
flyway:
locations: classpath:db
baseline-on-migrate: true
baseline-version: 0
fdfs: fdfs:

View File

@ -50,6 +50,7 @@
<include>*.yml</include> <include>*.yml</include>
<include>*.properties</include> <include>*.properties</include>
<include>*.json</include> <include>*.json</include>
<include>db/*.sql</include>
</includes> </includes>
<filtered>true</filtered> <filtered>true</filtered>
<outputDirectory>${file.separator}config</outputDirectory> <outputDirectory>${file.separator}config</outputDirectory>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
/*
Navicat Premium Data Transfer
Source Server : 15.2.21.238
Source Server Type : MySQL
Source Server Version : 50732
Source Host : 15.2.21.238:3310
Source Schema : share_platform
Target Server Type : MySQL
Target Server Version : 50732
File Encoding : 65001
Date: 14/06/2022 15:48:36
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Records of act_re_model
-- ----------------------------
INSERT INTO `act_re_model` VALUES ('1', 51, '能力申请', 'abilityprocess', NULL, '2022-04-13 18:36:31.681', '2022-05-30 10:58:37.536', 1, '{\"name\":\"能力申请\",\"description\":\"能力申请表单\",\"revision\":1}', NULL, '2', '3', '');
INSERT INTO `act_re_model` VALUES ('252725', 32, '能力资源上架', 'resourcemountapply', NULL, '2022-04-24 14:08:13.296', '2022-05-30 10:50:31.746', 1, '{\"name\":\"能力资源上架\",\"description\":\"能力资源上架审批流程\",\"revision\":1}', NULL, '252726', '252727', '');
INSERT INTO `act_re_model` VALUES ('277501', 20, '能力需求申请', 'abilitydemandapply', NULL, '2022-04-25 10:49:42.466', '2022-06-02 10:53:36.595', 1, '{\"name\":\"能力需求申请\",\"description\":\"能力需求申请\",\"revision\":1}', NULL, '277502', '277503', '');
INSERT INTO `act_re_model` VALUES ('485001', 18, '能力资源下架', 'resourcundercarriageapply', NULL, '2022-05-10 10:23:05.802', '2022-05-30 10:48:13.801', 1, '{\"name\":\"能力资源下架\",\"description\":\"能力资源下架\",\"revision\":1}', NULL, '485002', '485003', '');
INSERT INTO `act_re_model` VALUES ('5019', 8, '转正申请', 'correctionprocess', NULL, '2022-04-14 17:44:34.122', '2022-04-14 20:27:14.548', 1, '{\"name\":\"转正申请\",\"description\":\"\",\"revision\":1}', NULL, '5020', '5021', '');