开发者

Changing node ids from mysql.. is it possible?

开发者 https://www.devze.com 2023-01-09 12:19 出处:网络
Can I change node ids (nid) in mysql tables in order to update the IDs of the nodes in Drupal ? In other terms, if I change the nid (paying att开发者_JAVA技巧ention to keep they unique for each node)

Can I change node ids (nid) in mysql tables in order to update the IDs of the nodes in Drupal ?

In other terms, if I change the nid (paying att开发者_JAVA技巧ention to keep they unique for each node) in the 'node' table, directly from phpmyadmin, am I going to introduce bugs ?

thanks


The node id is used in a lot of places, so you have to be very careful doing something like that. It may very well lead to things breaking, like missing the content of the node which is stored elsewhere.

If the nodes are freshly imported it makes things less tricky, but it's hard to be sure you get everything right. The problem is that you might only find the problem when it's too late.

I believe that migrate creates some kind of join table when you import nodes, can that be used to match the node ids to the old ids?


I think it may work.

You need to keep in mind that the nid is not only referenced by other tables but can also be defined in some serialized data. If you serach through the whole database and make sure to change EVERY possible occurence of the nid, than it should be doable.


Considering that a node ID could be saved in a database table created by a third-party module, I think it's quite impossible to be sure to not create problems. If you run the SQL queries by hand, you need to be sure you checked every single tables, including the cache tables, which could contain a reference to a node into a serialized PHP object, or array.

0

精彩评论

暂无评论...
验证码 换一张
取 消