java - Create database upgrade diff with Liquibase -
i have 2 database schema files, both of them empty. let's there's version 1 , version 2 of database schema in db.v1.sql , db.v2.sql.
i'd create diff update database schema db.v1.sql db.v2.sql.
is liquibase capable that? there tool java?
yes, do-able using liquibase.
- create changelog.xml file lists .sql files separate changesets. think of file 'tempchangelog.xml' in file, add label attribute each of changesets "v1" or "v2".
- use
liquibase update
apply first label first database instance. - use
liquibase generatechangelog
"convert" sql liquibase xml changesets. 'realchangelog.xml' - modify 'realchangelog.xml add "v1" label attribute changesets.
- use
liquibase update
'tempchangelog.xml' apply second label second database instance. - use
liquibase diffchangelog
command compare database instance 1 database instance 2, appending changes 'realchangelog.xml' - modify 'realchangelog.xml' again add "v2" labels new changesets.
you have changelog.xml can used update database either v1 or v2.
synchronizing new changes orm separate exercise.
Comments
Post a Comment