forked from turimbar1/flyway-example-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFWD_DriftCheck.sh
31 lines (24 loc) · 919 Bytes
/
FWD_DriftCheck.sh
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
#!/bin/bash
set -euo pipefail
# Point to where flyway dev is
# If you didn't create the entrypoint script you may need to invoke flyway dev through dotnet
# e.g. /opt/flyway-desktop/dotnet/dotnet /opt/flyway-desktop/flyway-dev/flyway-dev.dll
flyway-dev() {
/opt/flyway-desktop/flyway-dev.sh --i-agree-to-the-eula "$@"
}
WorkingFolderPath=~/.
Url="jdbc:oracle:thin:@//localhost:1521/Dev1"
User="HR"
Password="Password"
Schemas='"HR"' # May be '' for SqlServer or '"Schema1", "Schema2"' for Oracle
# Set the paths
ArtifactPath="/tmp/artifact.zip"
ProjectPath="$WorkingFolderPath/flyway.toml"
MigrationPath="$WorkingFolderPath/migrations"
# schema model diffs
DiffOptions=$(cat <<-END
{ "url": "$Url", "user": "$User", "password": "$Password", "schemas": [$Schemas], "resolverProperties": [] }
END
)
echo "$DiffOptions" \
| flyway-dev diff -p "$ProjectPath" -a "$ArtifactPath" --from SchemaModel --to Target