Considerations
- If your focus is on Oracle databases, I prefer the SQLcl implementation of Liquibase, but if you work on multiple database engines you may be better to focus on using the normal Liquibase client.
- As mentioned previously, I don't think you should generate a changelog from an existing schema. I think you should only track changes from the day you start using Liquibase onward.
- All change scripts should have an equivalent "undo" script, but I don't like the concept of rollback as described in Liquibase changesets. Instead I feel a better solution is "fix forward". If a change has a problem and needs to be backed out, the "undo" script should be included as a new change in a changelog, and applied via the master.xml, so any form of rollback/undo is still a move forward. This includes reverting code object versions.
- Everything should be in version control, which is why I've included "git" in the paths as a reminder. The changelogs and the code don't have to be in the same repository though, depending on your requirements.
- Management of the changelog is important, because it is the serialisation of changes to the database. How you manage the changelog is an interesting process.
- This requires some discipline. So should your manual process, but I suspect many people are more lax than you can be when using an automation tool like this.
- I'm purposely keeping this scripts-based. I know a lot of people will not like this and will prefer to use the XML tag approach to creating changelogs. It just doesn't work for me at this point. SQLcl supports most of the Oracle objects, including the code objects, but it doesn't support data, which I think is important, especially for seed data. I could mix the XML tag approach and scripts for hings it doesn't support, but I don't like the inconsistency.
- Deciding how to approach different schema and privileged accounts takes some thought. In some cases you will need to coordinate changes to multiple schemas, including some via privileged accounts. The great thing about the SQLcl implementation is it's all based on the currently logged in user, so having a build agent that logs into sqlcl using a secure external password store is quite simple.
- I don't like the thought of relying on file names to control the apply order, but I know some other products encourage that. This is a personal choice, and the example changelogs here are named with an order in mind, even though we are not using it.
- Every change needs to be in a separate changeset, or this can affect the way failures are handled. That may feel odd to people who like to combine multiple changes into a single build scripts. This is one concession I'm prepared to make. You can still use multi-purpose scripts if you want to. Just be certain of your clean-up operations.
- Everything looks simple when managing a small number of objects and scripts. As things escalate is gets more difficult. Your approach, and mine, will change over time. That's OK.