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
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 Tool 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
For example, the 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
Change Log Locations
The following changelogs are executed when you populate the database:
extensions<includes all core changelogs> extensions ext-data main schema/schema-customizations-changelog.xml extensions ext-data main data/liquibase-changelog.xml <includes all extensions data changelogs>ext-data main schema/schema-initializer-changelog.xml commerce-engine core-schema main elasticpath-db-changelog.xml commerce-engine core-schema main core-changelog-master.xml
Generating Database Schema Documents
Using SchemaSpy, a Java-based command-line interface tool, you can generate database schema documents from your database.
Before you start
You must have Graphviz installed on your machine. Graphviz is required in the generation of the table/view relationships graph.
To generate your database schema documents:
Open the command prompt and navigate to
Execute the command below to run Maven’s site plugin and generate the documentation.
index.htmlin a web browser to view the schema documents