3

I'm developing a web application that also use Wordpress as part of it. I want to use Liquibase to track my database changes.

How to handle database changes made by automatic update script of Wordpress?

Can I just ignore them? and put only my own changes in Liquibase changelog file?

User
  • 373
  • 2
  • 8

2 Answers2

2

You could do a diffChangelog of the schemas after each WordPress upgrade so that Liquibase could keep track of the changes. You can just ignore them though - Liquibase doesn't really care about unknown schema objects. The only issue would be if your changes and the WordPress changes conflicted.

SteveDonie
  • 8,700
  • 3
  • 43
  • 43
  • Thanks, if I would use diffChangelog, I would also need to mark the changeSets as done in the database? How would I do that? – User May 05 '14 at 14:07
  • The easiest way is to use the changeLogSync or changeLogSync command to to mark them as ran. Or you can manually insert into databasechangelog – Nathan Voxland May 06 '14 at 13:10
  • @NathanVoxland , Thanks! It's still a bit unclear to me, so I've replied here http://forum.liquibase.org/topic/how-to-handle-database-changes-made-by-an-automatic-upgrade-script It would really help me if you can confirm or suggest improvements to the process I've described there – User May 06 '14 at 13:41
2

You can and should just ignore them.

Liquibase just does one thing. It keeps track of the fact that:

  • a certain command (say, createTable)...
  • ...that looked a certain way at time 0 (the name of the table, its columns, etc.)...
  • ...was definitively executed at time 0 (it stores this record in DATABASECHANGELOG).

That's it. It is not a structure enforcer or a database state reconstitution engine. It is quite possible—and permitted, and often expected—that the database will be changed by other tools and Liquibase will have no idea what went on.

So just keep your commands in your changelogs, don't worry about preexisting database structure, use preconditions to control whether or not your changesets run, and ignore everything else that might be going on in the database that happened due to other tools.

Laird Nelson
  • 15,321
  • 19
  • 73
  • 127