Quick:

If I manually alter the node table, with something like this "ALTER TABLE node AUTO_INCREMENT = 2056;" so the next node created in Backdrop will be 2056, will this mess things up?

Semi-Long:

I develop / work on my site cloudbrat.com offline (local WAMP) and push changes to the live site.   The live site is a user signup site so much more content (nodes) are created in the live version, therefore the node ID count is much higher.  However, for the content I as Admin create offline (and then online as well), I would like the node IDs to match.

I searched through all the tables looking for some "setting" like "node count" or something like that and didn't find anything so I'm just assuming that if I alter the node table auto_increment number it will just create the next node with that ID and everything will be... ok, right?

I could just make a back-up and try it out but I just don't want to make a bunch of nodes and then somewhere down the line the site explodes....

Comments

Hi JugglingCoder. Thanks for posting!

I don't have a definite answer to your question. But it's generally advised (wisely) not to mess up with the database directly. 

I'm wondering if there is a way to modify your workflow to accommodate for the fact that content IDs will increase when you work offline. How do you import your offline work? Why do you need the IDs you create offline to match the production site?

 

 

Thank you for your reply argiepiano,

"How do you import your offline work?"

It's the opposite.  As admin (and developer) I push all edited code to live site from my local WAMP.  Same with any content I create offline.

"Why do you need the IDs you create offline to match the production site?"

Because this website 1st uses Backdrop as the "head" which I use for the base website, user management, etc. and 2nd is the "app" which is custom coded plus using some other 3rd party apps. The Backdrop "head" also creates new nodes which creates various new user folders/files in the app.

I need to keep these folders (i.e. the ID of the node) in sync with both versions.  I currently do this with a WinSCP script + .bat file(s).  I can click it once and it synchronizes the offline/online versions.  However... it'll only work if all the offline/online node IDs are the same.  The live site node count always jumps ahead so I need to somehow manually jump the offline node count ahead to match.

Is it possible for you to export the database from live, copy it to local, import it on local and then your node ids may match?  Or are lots of nodes continually being created on live?

Perhaps you could:

  1. Create a skeleton draft node on live
  2. Export from live
  3. Import to local
  4. Finalise the content
  5. Test
  6. Copy to live

Unfortunately, the command line tool "bee" doesn't work natively on Windows.  It does work inside Windows Subsystem for Linux (i.e. WSL2) which is how I use it on a Ubuntu 20.04 instance, but that can help with importing and exporting the database, but I always try to make that one way (live to dev) except for initial deployment.

Thank you for your reply "yorkshirepudding".

Yeah, importing the "live" DB would be an option but I really don't want to import the live DB because a.) I want to keep the dev version "clean" and free of any user created nodes and b.) it would really bloat the offline version (size).

I guess some time in the future when I get a chance I'll just try altering the table and see how it goes (of course back-up before hand): "ALTER TABLE node AUTO_INCREMENT = THE_NEXT_NODE_I_WANT;"