0
votes

How can I create liquibase changeset custom rules?

The Problem

I want to make rules in my team, in which people don't do dangerous change on liquibase without knowing. I consider the dangerous things, specially things that make the database unusable to the old version of the application, making a rollback impossible.

Solution I thought Create a custom rule to validate the changesets, in which we forbid changes like: dropColumn, delete, dropTable, renameColumn

All these changes would break the build on maven, except if there is a comment on the same changeset with something like "i know what i'm doing".

The Question

Does liquibase offer any extension point where I can create this rule?

1

1 Answers

2
votes

Have you considered introducing code reviews instead? On the other hand if your goal is not to forbid using dropColumn, but to annotate it to make sure that developer knows what he/she is doing then you could introduce two interfaces e.g. BackwardCompatibleLiquibase and BackwardIncompatibleLiquibase - first interface would contain the 'safe' methods and the other would contain all of them.

IMHO it's better to educate people within your team how to make changes that won't break the DB instead of introducing changeset validator, because if no one reviews the changesets then there's a chance that people will hack your validator or add the example comment 'i know what i'm doing' to every change set so the build will always pass