Reputation: 103
I have an existing database on which I want to apply liquibase and generate a separate changelog for every table in order to create the current database scheme.
As far as I know, there is only the possibility to generate a single big changelog.xml for the entire database, which I did with commandline:
liquibase --driver=oracle.jdbc.OracleDriver \
--classpath=\path\to\classes:jdbcdriver.jar \
--changeLogFile=com/example/db.changelog.xml \
--url="jdbc:oracle:thin:@localhost:1521:XE" \
--username=scott \
--password=tiger \
generateChangeLog
However, I would like to generate a separate changelog.xml for every table. Let's say, if the database has three tables: butterfly, flower and bee, then there should be generated: changelog_butterfly.xml, changelog_flower.xml and changelog_bee.xml or something similar.
Any ideas much appreciated.
Upvotes: 3
Views: 1181
Reputation: 4365
Judging by documentation - there is no strightforward way to do this.
Also, from logical point of view: if the goal is to have changelog per table, then where to place changesets for foreign keys? Since they belong to both tables involved - there is contradiction here :)
Probably, one way to resolve contradiction would be to place foreign keys to separate changelog. However, it looks not very convenient, especially if take into account migrating DB after initial setup.
Either way, here are some recommendations about changelog organization.
Upvotes: 3