I have a project that I have been working on for a little while now. Like most projects we work on, we have a staging server to work on the code and the client’s can see what work is being done for approval. This server is different than the production server, for obvious reasons.
I ran into an issue awhile ago where I worked on a Webform node for quite awhile (it was complex). So when I went to roll it out, I created the node on the live site, and it had a different node ID than my local. This is to be expected, as the sites don’t share a database, and the production server is constantly getting new updates.
To fix it, I had to rename my custom template to the live node ID, which makes merging the changes I make later harder. I thought there MUST be a better way.
My first thought was to create the node and then change the local ID to match. But several Stack Overflow messages said avoid that like the plague.
But one SO post had a good idea: change the AUTO INCREMENT value in my local DB!
So what I did was first I created the node on the live site and left it unpublished for now. This new node had the ID of 4994. I then logged into PHPMyAdmin, selected the database for this Drupal site, and ran the following:
ALTER TABLE `node` AUTO_INCREMENT =4994;
I then went to my staging site and created a new webform and voila! It has the same node ID! So now I won’t have crazy conflicts to deal with.
Better idea? Let me know!