2

I have a Drupal 7 site with a UAT version and Production version. Most of the features on production have been overridden. I want to keep my repository up to date in case anything happens to my database I can redeploy with the most current (overridden) changes.

My question is: what is the best way to go about updating my Git repo without a lot of unnecessary work?

My thinking is that I could just download the features off of production, overwrite the features on my local and commit / deploy to remove the overrides. Is this a viable strategy? Is there any risk involved with this strategy?

I appreciate any help / nudge in the right direction.

0

Great question. I work in a Drupal agency where we see this all the time.

Imaging this scenario:

Locally you've made some amends to a site that overrides a bunch of features. Locally you can run feature updates, placing the changes from the database into the code and then get ready to push live. But when you go to push live, you see there are feature overrides existing on the live site. There can be feature overrides for a number of reasons but the most often one is fields and blocks moving. If there are additions in your code they will be ok, but if you need to revert one of the features to say, move a field, then it gets a bit tricky.

My personal solution to this is to download the latest live database and run feature updates from that database locally, then merge the code changes. Then when you push your code you will have your changes and your live sites overrides in the code.

This isn't perfect, but it's workable.

Why not just run feature updates on the live server and pull that code change locally for a merge? Most, usually all, servers don't allow write permissions in live environments. So cloning the db locally is often necessary for this.

It's also worth trying to structure you features well, it's an art not a science! I usually leave ALL blocks out of features as they always get overridden. Also don't make a feature for all content types or all views as that will easily be overridden. Yes you can make too many feature, this is where your experience will come into play and it gets easier the more you do it.

Our senior dev also hook_update_N which may be worth looking into.

| improve this answer | |

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.