2

I'm looking into setting up a development -> staging -> production workflow, and the biggest issue so far is figuring out how to sync the databases.

To this end, I'm trying to figure out exactly which actions will affect the filesystem, the database, or both. Here's how I think it works. Please correct me where I'm wrong, and let me know if my questionable answers are right!

  • Registering a new user - database
  • Adding a post or comment - database
  • Changing to a new theme - database?
  • Changing a theme's settings - database
  • Installing or removing a plugin - filesystem
  • Activating, or deactivating a plugin - filesystem
  • Updating a plugin - filesystem and database? (DB structure may change?)
  • Changing a plugin's settings - database
  • Uploading media - filesystem and database?
  • Editing custom files not included in a theme or plugin - filesystem
  • Upgrading Wordpress - filesystem?
  • 1
    Except Editing custom files not included in a theme or plugin every task affects Database. – bravokeyl Aug 11 '16 at 7:03
2
  • Registering a new user - database
  • Adding a post or comment - database
  • Changing to a new theme - database(yes)
  • Changing a theme's settings - database
  • Installing or removing a plugin - file system,database
  • Activating, or deactivating a plugin - file system,database
  • Updating a plugin - file system and database (DB structure may change if plugin has custom tables registered and in the new version if it has structure changes)
  • Changing a plugin's settings - database
  • Uploading media - file system and database
  • Editing custom files not included in a theme or plugin - file system(this depends on the actions you are taking)
  • Upgrading WordPress - file system,database
2

Almost everything is stored into database (mostly into {table_prefix}_options table) so probably each action listed by you will affect database.

To prove it try to activate plugin, then rename this plugin folder. In WordPress you will see that plugin has been deactivated, because it not exists (list of activated plugins is stored in database). Also upgrading WordPress will affect database - for example adding new tables (WP 4.4 added term meta table and functions to manage them).

2

Your approach is wrong, If you really into setting a fully proper dev cycle, you just don't do anything which is related to changing the DB as part of your development.

You can not track DB changes in any sane way and you can not merge DBs in any automatic way. All your changes should be in code files (php, js, css, whatever), and your code should be in GIT or SVN, and deploying to production should be a simple pull.

  • So, how can I test out potentially breaking changes that affect the database (which, per bravokeyl's answer, is pretty much everything)? It seems like the only way to do this is to do everything once on dev/staging, then again on production - an error-prone process, since I could forget how (or that) I did something. – Aaron Aug 11 '16 at 17:35
  • the idea is not to make any DB changes for changing the configuration of the site. DB changes should be related only to content – Mark Kaplun Aug 11 '16 at 19:14
  • 1
    I don't understand, how do you install/remove/activate/deactivate/update plugins or change plugin settings? Just do everything on production, test it out, and revert if it broke? – Aaron Aug 13 '16 at 2:14
  • 1
    you just include the files in your code, and call the setup function to populate the relevant options or set them by yourself. Yes this require more coding and better understanding of how the plugin works, Then you test it as if it was your own code, which is how you should always treat plugins. This is probably over kill for small sites, but that is the way to go for big sites on which there is a frequent need to move from staging to production – Mark Kaplun Aug 14 '16 at 7:41
  • You're right - that is overkill for my small site (and very limited PHP experience). Would you recommend a less-than-proper dev cycle, or do I just have to choose between doing everything on production and duplicating actions across dev, staging, and production? – Aaron Aug 16 '16 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.