1

I have a node with nid = 548754 and I needed to be 301. Is there a safe way to do this? There are a lot of tables related to 548754.

What if I export the database, then open sql file, replace the number and then import the database. Will this work?

  • Why do you need to change the nid? It's better don't do that imho, if you explain the problem because you want to change maybe we can find a workaround. Read this – backit Oct 20 '15 at 15:01
  • it should work if you change nid and entity_id in all tables, but you can not know if some modules didn't named it just id. There yould be a problem if you replace it in editor like a string. – Paul Bönisch Oct 20 '15 at 15:02
  • I understand... – chefnelone Oct 20 '15 at 15:05
  • Not possible, unless want to re-import/re-write your whole database. If you consider that, I could answer how potentially this can be done in few commands. – kenorb Oct 20 '15 at 15:42
  • 1
    The easiest would be something like: drush sql-dump --ordered-dump | sed s/548754/301/g > new.sql; cat new.sql | drush sqlc (assuming 301 doesn't exist and nothing else conflicts with 548754). This won't be bullet-proof for serialized data which would break in that case (if serialized data is cache, can be removed). – kenorb Oct 20 '15 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.