Liquibase
Liquibase
Overview
Liquibase is an open source (Apache License), database independent management library with a database-backed version control system.
Liquibase tracks all database changes in one or more changelogs. Each changelog contains one or more changesets. Each changeset describes the changes that need to be applied to the database in a database independent manner. As Liquibase applies the changeset to your database, it writes a row in a DATABASECHANGELOG table indicating the changeset is applied. On subsequent executions, Liquibase compares the changesets in the changelog with the ones stored in DATABASECHANGELOG. If a changeset has already been applied, Liquibase will not reapply the change and will not add a new entry in DATABASECHANGELOG.
Liquibase creates a checksum for each changeset. Once you have applied a changeset to a database, it must not be edited in the changelog or Liquibase will require you to resolve the checksum mismatch.
For more information, see the Liquibase Manual.
Data Population with Liquibase
Elastic Path projects use a combination of Liquibase scripts and Import/Export data to populate the commerce database.
The Data Population Accelerator provides a unified mechanism to create new databases or update existing databases. It uses Liquibase to manage the execution of both Liquibase scripts and Import/Export data by wrapping each Import/Export data set in a Liquibase change set. This has a number of benefits:
- Import/Export updates are applied only once to the database, unless configured otherwise.
- Using Liquibase contexts, Import/Export data sets can be applied only to specific environments (e.g. test data that shouldn't go to production).
- Property placeholders can be defined in both Liquibase and Import/Export data. These placeholders are filtered at run time using an external properties file to support populating environment-specific values.
The following changelogs are executed when you populate the database:
extensions/database/ext-data/src/main/resources/schema/schema-initializer-changelog.xml commerce-engine/liquibase/core-schema/src/main/resources/elasticpath-db-changelog.xml commerce-engine/liquibase/core-schema/src/main/resources/core-changelog-master.xml <includes all core changelogs> extensions/database/ext-data/src/main/resources/schema/schema-customizations-changelog.xml extensions/database/ext-data/src/main/resources/data/liquibase-changelog.xml <includes all extensions data changelogs>