Create a Flow file
Liquibase Flow files transform your database change management from running individual commands one at a time into executing comprehensive, automated workflows with a single command. Instead of manually running separate commands for quality checks, updates, rollback tests, and reporting—risking missed steps or inconsistent processes across environments—you can define your entire deployment workflow once and run it reliably everywhere. Once you review the What is a flow file article, you are ready to create your first file.
Procedure
In the CLI, run the liquibase flow command.
liquibase flowSelect options 1, 2, or 3 listed in the output.
WARNING: No flow file detected. Would you like to create and automatically use 'liquibase.flowfile.yaml' ?
[1] Yes, create and use sample flow file in the Current Working Directory
[2] Yes, create and use sample flow file at a path I will specify
[3] Just create sample flow file in the CWD, do not use, and exit command
[n] No, do not create sample file, and exit command.
[1]:
Open the newly created file and review each section.
Default flow file
########## LIQUIBASE FLOWFILE ##########
########## learn more /pro/user-guide-4-33/what-is-a-flow-file ##########
##Note: Any command which fails in any stage below result in the command stopping, and endStage being run.
##A flow file can have one or more stages, each with multiple "actions",
##or your flow file can have multiple stages with fewer actions in each stage.
stages:
##The first stage of actions
Default:
actions:
#
# Policy Checks for changelog
#
- type: liquibase
command: checks run
cmdArgs: {checks-scope: changelog}
continueOnError: true #Continue flow execution if this commnand fails.
if: 'exitCode == 4'
#Flow failed with an exit command, but continue-on-error is true
#Exit code is 4 so checks run will execute
#
# Run the update
#
- type: liquibase
command: update
#
# Policy Checks for database
#
- type: liquibase
command: checks run
cmdArgs: {checks-scope: database}
##do these actions after all flow commands, regardless of whether the above commands were successful
endStage:
actions:
- type: liquibase
command: history