-2

Is there a way to extract only the content (data) that content authors have added to a Production Drupal instance?

Basically, I'm trying to figure out which tables in MySQL are responsible for holding the content data (nothing configuration related), export the data from those content tables, and then import (the diff) into my local MySQL database.

Thanks you.

closed as too broad by leymannx, Pierre.Vriens, mradcliffe, Shawn Conn, jhedstrom May 3 at 16:38

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    It'll be a lot more trouble than it's worth to do MySQL diffing. – Kevin Feb 26 '17 at 23:38
  • 1
    You would be better off using the Migrate API (drupal.org/docs/8/api/migrate-api/migrate-api-overview) to migrate your content, as database diffing will result in problems in the future if you add modules that act on nodes. – Jaypan Feb 27 '17 at 0:12
  • Thanks for your replies Kevin and Jaypan. I will look into the Migrate API. I'm using Docker containers (one for Drupal and one for MySQL) in my system, and Git to keep all Drupal code changes (modules, theme/template customizations, etc.) and Drupal configuration (which is stored in MySQL) in sync. Everything's working great locally, but just thinking about how to handle updates once in Production. Thanks again! – kvjava1 Mar 2 '17 at 0:11
1

Not sure about a good solution for this, but this is likely a pretty hard problem to solve, keep in mind that it's not just about new content, but also updates and deletions.. how are you going to track that?

The thing is that almost every table in Drupal holds content. Configuration is limited to config, key_value and a few others, almost everything else is content in one way or another. And key value is also not something you can exclude and transport in a different way, so the only thing you could exclude really is the config table.. but that's tiny, compared to the others and actually not really worth excluding, except when you want to explicitly avoid removing configuration.

  • Thanks for your reply! What's the recommended approach to keep a Production Drupal instance in sync with a Local one? There shouldn't be any configuration changes in Production; only content admins adding new content. Locally, I will be developing new functionality (or fixing existing code); content updates should be minimal, as I would only be creating test content. I'd like to pull down the latest content from Prod, make updates, check in the code and DB data into Git, and push out new version of the system (using Docker). But I can't ask admins to stop updating content during this process. – kvjava1 Feb 27 '17 at 23:28
  • You do not want to deploy the DB, that's what configuration import is for. If you don't have a very large DB, then I would just frequently sync it down with a full export and import (drush sql-sync for example), but don't add it to git. There are various questions sessions related to config deployments, that's too much for this question to answer in depth) – Berdir Feb 27 '17 at 23:32
  • Thanks again for your reply Berdir. What is your typical process for updating a Drupal site once it's gone live? In my case, there isn't too much data, as it's input by content admins (not by visitors/end-users), so sync'ing it down will be feasible. Since Drupal stores configuration in the DB, I'm trying to use Git to keep the DB configuration and Drupal code changes (module additions, theme updates, etc.) in sync. Just trying to figure out how to update Prod once the site is deployed? Sounds like "do 'config export' locally" and "do 'config import' in Prod? How to push code changes to Prod? – kvjava1 Mar 2 '17 at 0:02
  • modulesunraveled.com/… is a free and detailed series of videos explaining all kinds of things around configuration and deployments. Basically, what you do is drush cex, which exports all configuration as easy to diff/merge yaml files, you can commit those and import again on production. – Berdir Mar 2 '17 at 6:22
1

I had some good results using this module: https://www.drupal.org/project/content_sync You have to ensure the module is installed on both your local and remote destinations and then use the import/export feature that it introduces into the system to export content from 1 site and import it to the other. This requires no database manipulation and doesn't interfere with config or code. I did have an issue where some images would not import but all other fields did. I was able to easily correct this though and the Issues listed on the module page appear to have found a solution for that too.

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