Where I work, we develop many frameworks and some applications that make use of these frameworks. Each of these frameworks has its own entities, thus the application that making use of them, will have to create all database tables for them.
Recently, we started using Liquibase to automate and simplify the process of creating the database for an application. This is specially useful for the developers, that need to create the entire database on their machines when developing and testing an application.
Each of the frameworks has a changelog with the required tables, and the main application has a changelog that includes each of the required framework’s changelog XML.
With this model, the developer can easily create the application database running liquibase update only for the application’s changelog.
Everything was fine, but then I’ve stumbled into the following situation:
Suppose three frameworks and an application with the following changelogs:
- Framework A: changelog_A.xml (creates some tables)
- Framework B: changelog_B.xml (creates some other tables and includes changelog_A.xml.
- Framework C: changelog_C.xml (creates some other tables and also includes changelog_A.xml.
- Application: changelog_application.xml (creates some other tables and also includes chagenlog_B.xml AND changelog_C.xml
My problem happens if I run liquibase update for changelog_application.xml. Liquibase will see changelog_A.xml two times and will give me an error complaining of repeated changesets.
Don’t you think this is scenario that liquibase should handle? Can you suggest a better practice for this situation?