After building/testing a Drupal 7 site, I deployed it to prod server, exporting all views as features. Now the views are all 'in database' on test site, but 'in code' on live site - on the theory that no views editing should be done in prod. Now if I want to copy my prod database (but not code) back to my testing site for a new phase of development, what's the best way to avoid overwriting (or wiping out) views 'in database' on my dev site?

  1. Should I have renamed the views when creating features?
  2. do I export/import the views, either from/to testing or from prod to testing?
  3. is there some other way to selectively preserve views in the testing db when copying back an sqldump?

Thanks much!

2 Answers 2


We have the following:

  • DEV code base. (dev-code)
  • DEV database. (dev-db)
  • PROD code base. (prod-code)
  • PROD database. (prod-db)

Here is a simple dev flow to change a view, deploy to prod and then continue development:

  1. [dev-db] Create a new view or modify an existing view.
  2. [dev-code] Create a feature module out of that view or re-create an existing one.
  3. [dev-db] Enable the feature module on DEV.
  4. [prod-code] Commit the change and push it to PROD or upload the changes to PROD.
  5. [prod-db] Enable or Revert the feature on PROD.
  6. [prod-db] Export database from PROD (and preferably sanitize it to remove sensitive data)
  7. [dev-db] Import the database dump to DEV.
  8. [dev-code] Continue development!

You shouldn't have any problem if you are following this flow.

  • Thanks, this sounds good - just to clarify, when making new changes to a dev view I'd just edit in views UI, then "recreate" the feature and deploy new versions in dev, then prod?
    – Annie G
    Commented May 1, 2015 at 20:44
  • Right, let's say you have a views in feature and it's not overridden. You make the changes in views UI and then re-create the feature. Now, the changes are in code and the views in not overridden. You just need to commit the changes, push to prod and revert the feature there.
    – Alexar
    Commented May 2, 2015 at 6:20
  1. Before synchronizing the database back to TEST environment, you should export all your views into code in your TEST environment, overriding the previous code.
  2. Then revert your views to code.
  3. Then synchronize the DB from DEV to TEST.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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