Skip to content

Commit 33ef5c1

Browse files
create generic cookbook for sample POC
1 parent 010826d commit 33ef5c1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
#TODO Hoist vars here
2-
1+
# Variables to be changed by user
2+
$configFiles = "C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml"
3+
$workingDirectory = "C:\WorkingFolders\FWD\NewWorldDB"
4+
$schemaModelLocation = "./schema-model"
5+
$environment = "test"
6+
$target = "043.20250716213211"
7+
$cherryPick = "045.20251106201536"
38

49
# generic deployment
5-
flyway migrate -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test
10+
flyway migrate -configFiles="$configFiles" -workingDirectory="$workingDirectory" -schemaModelLocation="$schemaModelLocation" -schemaModelSchemas= -environment=$environment
611

712
# create snapshot after changes
8-
flyway snapshot -environment=test -filename=snapshothistory:current -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model"
13+
flyway snapshot -environment=$environment -filename=snapshothistory:current -configFiles="$configFiles" -workingDirectory="$workingDirectory" -schemaModelLocation="$schemaModelLocation"
914

1015
# undo back to a specific target number
11-
flyway undo -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test -target=043.20250716213211
16+
flyway undo -configFiles="$configFiles" -workingDirectory="$workingDirectory" -schemaModelLocation="$schemaModelLocation" -schemaModelSchemas= -environment=$environment -target=$target
1217

1318
# cherryPick forward
14-
flyway migrate -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test -cherryPick=045.20251106201536
19+
flyway migrate -configFiles="$configFiles" -workingDirectory="$workingDirectory" -schemaModelLocation="$schemaModelLocation" -schemaModelSchemas= -environment=$environment -cherryPick=$cherryPick
1520

1621
# drift and code analysis report with snapshots
1722

18-
1923
# run drift and code analysis (TO SEE DRIFT ALTER TARGET DB OUTSIDE OF FLYWAY)
2024
# check can be configured to fail on drift or code analysis triggering
2125
# it's possible to capture changes as well, but it is a duplication of what's stored in schema model and requires an extra database to deploy to in a CI fashion
22-
flyway check -drift -code -dryrun -environment=test -check.code.failOnError=false -check.failOnDrift=false -check.deployedSnapshot=snapshothistory:current -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model"
26+
flyway check -drift -code -dryrun -environment=$environment -check.code.failOnError=false -check.failOnDrift=false -check.deployedSnapshot=snapshothistory:current -configFiles="$configFiles" -workingDirectory="$workingDirectory" -schemaModelLocation="$schemaModelLocation"
2327

2428
# generic deployment
25-
flyway migrate -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test
29+
flyway migrate -configFiles="$configFiles" -workingDirectory="$workingDirectory" -schemaModelLocation="$schemaModelLocation" -schemaModelSchemas= -environment=$environment
2630

2731
# create snapshot after changes
28-
flyway snapshot -environment=test -filename=snapshothistory:current -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model"
32+
flyway snapshot -environment=$environment -filename=snapshothistory:current -configFiles="$configFiles" -workingDirectory="$workingDirectory" -schemaModelLocation="$schemaModelLocation"

0 commit comments

Comments
 (0)