fix 集成flyway db

master
陈景阳 3 years ago
parent 78f81416c3
commit 6e427cf6c9
  1. 40
      pom.xml
  2. 16
      src/main/resources/db/migration/V1_0_0/V1_0_0_202201041302__create_sys_user.sql

@ -51,6 +51,12 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
</dependency> </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
@ -65,6 +71,20 @@
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<profiles>
<profile>
<id>demo</id>
<properties>
<jdbc.url>jdbc:mysql://127.0.0.1:3306/anyin-demo?characterEncoding=UTF-8<![CDATA[&]]>useSSL=false<![CDATA[&]]>autoReconnect=true<![CDATA[&]]>allowMultiQueries=true</jdbc.url>
<db.user>root</db.user>
<db.password>rootroot</db.password>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<build> <build>
<finalName>shiro-to-token</finalName> <finalName>shiro-to-token</finalName>
@ -82,6 +102,26 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<!-- 配置flyway -->
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>4.1.0</version>
<configuration>
<user>${db.user}</user>
<password>${db.password}</password>
<driver>com.mysql.jdbc.Driver</driver>
<url>${jdbc.url}</url>
<locations>
<location>db/migration</location>
</locations>
<table>schema_version</table>
<cleanDisabled>true</cleanDisabled>
<outOfOrder>true</outOfOrder>
<baselineOnMigrate>true</baselineOnMigrate>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

@ -0,0 +1,16 @@
drop table if exists `sys_user`;
create table `sys_user`
(
`id` int(11) auto_increment,
`username` varchar(32) not null comment '用户名',
`nickname` varchar(64) not null default '' comment '昵称',
`password` varchar(64) not null default '' comment '密码',
`del_flg` int(11) not null default '1' comment '0删除;1正常;默认1',
`remark` varchar(256) default null comment '备注',
`create_by` int(11) default '0' comment '创建者',
`create_time` datetime default current_timestamp comment '创建时间',
`update_by` int(11) not null default '0' comment '更新者',
`update_time` datetime default current_timestamp on update current_timestamp comment '更新时间',
primary key (`id`)
) engine = innodb
default charset = utf8mb4 comment ='用户表';
Loading…
Cancel
Save