Things that can go wrong with your views export

November 29, 2009
blog author

Appno Blogger

Appnovation Coop

I exported a view to another server and lost it, but it was right there, in my code, anyone could see it there - yet not in a list of views. What happened? – Well, after all, it appeared to have an easy explanation: When I exported my view and put it into hook_views_default_views function, I forgot that I also needed to export some content type to which I had added a new field. When Drupal tried to import my view it was looking for the field that did not exist in a database. The result – no imported view whatsoever. No error messages, nothing! I need to mention that this happened in Drupal 5 – maybe a Drupal 6 would have given me a little warning? – I never tried to repeat my mistake there.

What else can go wrong with your view export? It can happen that vocabularies in your local working database have different IDs (vids) than those on the production server (let’s say that after taking a database dump from a production server you created and then deleted a couple of vocabularies – the id of the next vocabulary on your local DB will be bigger than the id of the next one in the production DB). You work on your local creating views, export them to a different server and all your new views point to the wrong vocabularies. This is sad. Now you are going to be pretty creative fixing this problem without re-creating all the views or editing exported code (in which all vids are hard coded). What else can go wrong?.. share some of your experience here!