Managing the Database
Managing the Database
Note: Before you Begin
- Make sure you are on a machine that has access to the following items:
- Apache Maven 3.0.5
- Your Maven Nexus server
- Subversion
- Your staging or production database
- Configuring the Database Profile to your production database.
Populating an Empty Production Database
- Perform a release of your Elastic Path extensions, including the database populator, data, and schema extension projects.
- Using Subversion, checkout the database populator project from the release.With the command prompt, navigate to the database populator's root directory and run the following Maven command:
mvn package -Dimport
Note: Alternative Method of Population
An alternative method of populating your production database would be to do a backup/restore of an already populated staging database.
Updating a Populated Production Database
To update a database that has already been integrated with Liquibase:
- Perform a release of your Elastic Path extensions, including the database populator, data, and schema extension projects.
- Using Subversion, checkout the schema extension project from the release.
- With the command prompt, navigate to the schema extension's root directory.If you would like to see a report about what changesets have already been applied to the database, what changesets will be applied, and what SQL will be executed, run:
mvn liquibase:dbDoc
If you want a list of just the changes that will be applied, run:mvn liquibase:status
If you want just the SQL that will be executed, run:mvn liquibase:updateSQL
This will generate a file named migrate.sql in <schema extension root>\target\liquibase that contains the SQL Liquibase will run on your database.Warning: Editing migrate.sqlWe strongly recommend against editing migrate.sql. Any problems with the generated SQL should be addressed in the Liquibase Changelog.
- Run the following Maven command to update the database:
mvn liquibase:update
Porting the Liquibase Changelog to Database Replicas
Copies of a database already integrated with Liquibase are compatible with the original database's changelog. If you have moved your database somewhere else, configuring your database profile to match your new target database will enable you to run the changelog in your schema extension project on the copy.