-1

I am looking for a solution to sync DB between multiple developers (us at the office..).

We use Wordpress and MAMP (for now, MAMP/Headless WP and NPM/React in the future) and we want to use Appveyor (or similar) to deploy at dev-server and live-server, and want the DB to be synced everywhere or at least among us and the dev server and have a secondary (free standing) on the live-server.

Can this be done with Liquidbase or is there a better option?

Thanks :)

Haffy
  • 25
  • 6

1 Answers1

0

I don't know a whole lot about WordPress and how it uses the database, but in theory this should be possible as long as you are talking about syncing the schema changes. If you are also trying to sync the data, then Liquibase is not the right tool for the job.

To do this with Liquibase, try installing using the installer and working through some of the examples to get an idea for how the tool works. The examples use a local h2 in-memory database, so it is pretty painless to try things and start over if you mess things up.

After getting a feel for things, you will want to use the Liquibase generateChangeLog command to create the initial changelog that contains all the instructions for creating the schema as it exists on the database you are using when you run generateChangeLog. Then test that you can run liquibase update on a separate database and have WordPress use that database successfully.

Once you have proven that workflow, you can continue by following this pattern:

  1. Before making changes to the WordPress schema, run liquibase snapshot to create a JSON formatted snapshot of the "DEV" schema - the schema you are changing in development mode. You will need additional options to generate the JSON format snapshot.
  2. Make the desired changes to the WordPress "DEV" schema, most likely by using the WordPress app itself.
  3. Use liquibase diffChangeLog to compare the JSON snapshot to the newly-altered "DEV" schema. This will add changesets to the existing changelog file that describe how to alter the schema to create the desired changes.
  4. Use liquibase changeLogsSync on the "DEV" schema to update the liquibase tracking tables so that liquibase knows that the changes in the changelog already exist in that database.
  5. Use liquibase update against the "PROD" database to have the new schema changes show up in that environment.

This workflow is described in the Liquibase docs for the snapshot command.

ps - there is no d in Liquibase :-)

SteveDonie
  • 8,700
  • 3
  • 43
  • 43