Added| 新增migration設定

This commit is contained in:
2022-11-14 14:16:16 +08:00
parent efd3fca1c7
commit 376db324bd
9 changed files with 119 additions and 17 deletions

View File

@@ -1,20 +1,30 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.jooq:jooq-codegen:3.6.1'
classpath 'org.flywaydb:flyway-core'
classpath "org.flywaydb:flyway-mysql:9.2.0"
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id "org.flywaydb.flyway" version "8.5.13"
}
allprojects{
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'org.fycd'
version = '0.0.1-SNAPSHOT'
version = '0.0.1'
sourceCompatibility = 17
targetCompatibility = 17
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
}
@@ -28,8 +38,6 @@ allprojects{
implementation 'org.springframework.boot:spring-boot-starter-jooq'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
@@ -48,3 +56,32 @@ dependencies {
implementation project(':security-core')
}
task migrateDB(type: org.flywaydb.gradle.task.FlywayMigrateTask) {
driver = 'org.mariadb.jdbc.Driver'
url = 'jdbc:mariadb://localhost:3306/fycd?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Taipei'
user = 'root'
password = 'roottoor'
locations = ['filesystem:migrations']
target = 'latest'
baselineVersion = '0.0.1.0.1'
baselineOnMigrate = true
validateOnMigrate = true
outOfOrder = true
placeholderReplacement = false
}
task cleanDB(type: org.flywaydb.gradle.task.FlywayCleanTask) {
cleanDisabled = false
driver = 'org.mariadb.jdbc.Driver'
url = 'jdbc:mariadb://localhost:3306/fycd?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Taipei'
user = 'root'
password = 'roottoor'
locations = ['filesystem:migrations']
target = 'latest'
baselineVersion = '0.0.1.0.1'
baselineOnMigrate = true
validateOnMigrate = true
outOfOrder = true
placeholderReplacement = false
}