Skip to content

Commit 7bcccc7

Browse files
committed
build: 使用flyway的gradle插件完成数据迁移工作
1 parent 2e0dfe0 commit 7bcccc7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ docker network create hoteler-network
3333
3. 启动数据库
3434

3535
```shell script
36-
docker-compose up db
36+
docker compose up
3737
```
3838

3939
### 数据库迁移
4040

4141
```shell script
4242
mvn flyway:migrate
43+
gradle flywayMigrate
4344
```
4445

4546
### 构建

build.gradle

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'org.springframework.boot' version '2.5.0'
33
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
4+
id "org.flywaydb.flyway" version "7.8.2"
45
id 'java'
56
}
67

@@ -31,13 +32,19 @@ dependencies {
3132
// Runtime, com.sun.xml.bind module
3233
implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.1'
3334
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
34-
implementation 'org.flywaydb:flyway-core'
35+
implementation 'org.flywaydb:flyway-core:7.8.2'
3536

3637
developmentOnly 'org.springframework.boot:spring-boot-devtools'
3738
testImplementation 'org.springframework.boot:spring-boot-starter-test'
3839
testImplementation 'org.springframework.security:spring-security-test'
3940
}
4041

42+
flyway {
43+
url = 'jdbc:postgresql://127.0.0.1:5432/postgres'
44+
user = 'postgres'
45+
password = '123456'
46+
}
47+
4148
test {
4249
useJUnitPlatform()
4350
}

0 commit comments

Comments
 (0)