Database Versioning - Liquibase
Liquibase is an open-source tool for tracking, managing and applying database changes. It’s an alternative to Hibernate’s auto-ddl generation feature that is not recommended by the Hibernate team for use in production.
fastCode uses Liquibase to add authentication related tables and data and add-ons related tables to your existing application database schema.
Liquibase has concepts of a database change log table and database changesets that can described using an XML (and other) formats. When the application runs, Liquibase compares the change sets with entries in the database change log table to check which change sets have already been applied to the database. The change sets that are not applied are then applied and the database change log table is updated so that these changes are not re-applied on subsequent application runs.
The typical workflow for a developer using fastCode would be as follows:
-
Create the database schema
-
Generate the application using fastCode Application Generator
-
Make changes to the database schema directly
-
Update the application using fastCode Application Generator
-
Make changes to JPA Entities in code
-
Create Liquibase change sets to reflect these changes
-
On subsequent run of the application, Liquibase updates the database schema using the defined change sets
Therefore, when using fastCode, developers needs to create Liquibase change sets only when they directly change the JPA entities in code. If they make changes to the database directly and then update the application using the fastCode application generator, there is no need to create Liquibase change sets.
This also means that in a fastCode application, Liquibase change sets only represent changes that were directly made to the JPA Entity code and not to the database.
Updated over 2 years ago