I’ve started to use Unitils for my unit testing but I’d like to use liquibase as my database versioning.
One of the features dbmaintainer offers is to disable all foreign key and not null contraints.
Is it possible to add this feature to liquibase?
The reason is that it helps to minimise and maintain the test data required for unit testing.
So during testing, Liquibase would dropall, load chnageset and disable contraints, then we would run our unit tests using unitils.
I did use a combination of both. i.e. Allow liquibase to generate the migrate.sql file, then dbmaintainer would then load the script and would automatically disable contraints.
I was having difficulty processing stored procedures via dbmaintainer, I’m sure I could overcome them but I’d perfer to use one solution for database versioning.
There isn’t a built-in way to disable them in liquibase currently, but it is just a matter of finding/creating the SQL to do it. Note: some databases are easier than others. Until there is support, it may be just a matter of adding an SET CHECKS=0 or similar changeset to your changelog, or if you are needing to call it many times, you could create an extension to handle it (http://liquibase.org/extensions)