-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
53 lines (44 loc) · 1.41 KB
/
build.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
buildscript {
dependencies {
classpath "org.postgresql:postgresql:42.2.14"
}
}
plugins {
id "org.flywaydb.flyway" version "7.2.1"
}
ext {
envName = System.getenv("CABBAGE_TARGET_ENV")
cabbageDbPassword = System.getenv("CABBAGE_DB_PASSWORD")
cabbageDbId = System.getenv("CABBAGE_DB_ID")
cabbageDbConnection = "db.${cabbageDbId}.supabase.co:5432/postgres"
}
flyway {
url = "jdbc:postgresql://${cabbageDbConnection}"
user = 'postgres'
password = cabbageDbPassword
}
task checkFlywayEnv(){
group "flyway"
description "check the environment is configured for running flyway"
doFirst {
assert envName : "CABBAGE_TARGET_ENV env var not set"
assert cabbageDbId : "CABBAGE_DB_ID env var not set"
assert cabbageDbPassword : "CABBAGE_DB_PASSWORD env var not set"
assert cabbageDbConnection : "DB connection not set"
}
doLast {
logger.warn "cabbage target environment is: $envName"
}
}
flywayClean.doFirst{
// see https://github.com/supabase/supabase/discussions/344#discussioncomment-182886
assert false: "must not run flywayClean on supabase databases"
}
// don't let any of these run if the env isn't configured properly
flywayInfo.dependsOn checkFlywayEnv
flywayBaseline.dependsOn checkFlywayEnv
flywayClean.dependsOn checkFlywayEnv
flywayMigrate.dependsOn checkFlywayEnv
flywayRepair.dependsOn checkFlywayEnv
flywayUndo.dependsOn checkFlywayEnv
flywayValidate.dependsOn checkFlywayEnv