Hello,

If I export my database to a text format, is there any way I could change node id numbers without breaking the site?

Thanks in advance!!

Comments

davedelong’s picture

Theoretically, yes. Realistically, no.

Afief’s picture

As davedelong said, it is theoretically possible, but it'll feel like pulling teeth.

You'll need extensive knowledge of drupal's database, you'll need to know how everything is referenced(and believe me, changing a node's ID is gonna change a LOT of things) and you'll have to take into account the additional tables your modules created... As I said, pulling teeth.

On the other hand, you could probably use the path module to fake a node's ID by setting the path node/101 to point to the node you want to change(this will not work if there is a node with the 101 id though).

fjuqp’s picture

Thank you guys for your answers. I had the same feeling this could be like pulling teeth.
I just wanted to know what other users thought.

Bye!!

webalchemist’s picture

I wanted to change my node number... but then I used a 301 redirect instead!

http://drupal.org/node/155330

Happy Hacking!

amarin’s picture

Thanks you saved my life!!!

I deleted a node by mistake.

FranCarstens’s picture

If you have some idea of how a SQL database works you can use the following.

UPDATE [your_table_name] SET [your_table_field] = REPLACE([your_table_field], '[string_to_find]' , '[string_to_be_replaced]');

For Example:
SQL Find Replace
UPDATE content_field_color_code SET nid = "1413" WHERE nid = "9992";
UPDATE content_field_image_cache SET nid = "1413" WHERE nid = "9992";
UPDATE content_field_shirt_code SET nid = "1413" WHERE nid = "9992";
etc...

DISCLAIMER:
- Failure to backup your database;
- Being over confident;
- Making typos
can cause irreparable damage. Proceed with CAUTION.

Adapted from: http://www.barrywise.com/2009/02/global-find-and-replace-in-wordpress-us...

-- If no-one asked Drupal questions there would be no Drupal answers --