-
Notifications
You must be signed in to change notification settings - Fork 0
/
liquibase.gradle
34 lines (27 loc) · 1.03 KB
/
liquibase.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
configurations {
liquibase
}
dependencies {
liquibase group: 'org.liquibase.ext', name: 'liquibase-hibernate5', version: 3.6
}
//loading properties file.
Properties liquibaseProps = new Properties()
liquibaseProps.load(new FileInputStream("src/main/resources/liquibase.yaml"))
task liquibaseDiffChangelog(type: JavaExec) {
group = "liquibase"
classpath sourceSets.main.runtimeClasspath
classpath configurations.liquibase
main = "liquibase.integration.commandline.Main"
args "--changeLogFile=" + "src/main/resources/db/changelog/db.changelog-diff-" + buildTimestamp() + ".yaml"
args "--referenceUrl=" + liquibaseProps.getProperty('referenceUrl')
args "--username=" + liquibaseProps.getProperty('username')
args "--password=" + liquibaseProps.getProperty('password')
args "--url=" + liquibaseProps.getProperty('url')
args "--driver=" + liquibaseProps.getProperty('driver')
args "diffChangeLog"
}
def buildTimestamp() {
def date = new Date()
def formattedDate = date.format('yyyyMMdd-HHmm')
return formattedDate
}