2

I'm using Feeds to import nodes from another system. This system uses very long number for its node id, like: 17675272378. As you can see this number has 11 digits. The problem is that Drupal only allows a nid value up to 10 digits, then the import just fails.

I thought of changing the length value for nid for the node table directly in the database. But it is not that simple there are a lot of other tables which has this field like: the entity_id field for the field_data_body table.

Maybe I can get to change the values in the database if I export the table and then find and replace the value '10' for '15' and then after I replace the database which the new one. But my question is: will I get other problems if I do this?

How can I sort this out?

Here are my captures:

enter image description here

enter image description here

2
  • @AdrianCidAlmaguer I thing "feeds" tag is irrelevant here. the real problem does not depend on the way data was imported. Feeds, Backup And Migrate, CSV Import etc would all act exactly the same way.
    – Mołot
    Commented Jul 6, 2015 at 14:59
  • 1
    @chefnelone if you don't need that id as Drupal nid, you can create a number field(unique) for that and import with auto generate NID.
    – CocoSkin
    Commented Jul 6, 2015 at 16:09

2 Answers 2

3

Forcing the import to use the ID of the other system will break the sequential nature of the drupal nid. You should add a textfield on the receiving site to hold the old site id and let drupal assign new ones.

2
  • I agree that and I highly recommend not to change this field , nodes are usually joint to other modules table using nid so if you change that there will be some problems Commented Jul 6, 2015 at 18:19
  • I agree, I will change the value just before feeds import them.
    – chefnelone
    Commented Jul 7, 2015 at 6:08
2

You must alter your table to change your data type from INT to BIGINT because your number 17675272378 is not suported by the INT data type:

ALTER TABLE `node` CHANGE `nid` `nid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;

ALTER TABLE `field_data_body` CHANGE `entity_id` `entity_id` BIGINT UNSIGNED NOT NULL;

INT - A normal-sized integer that can be signed or unsigned. If signed, the allowable range is from -2147483648 to 2147483647. If unsigned, the allowable range is from 0 to 4294967295. You can specify a width of up to 11 digits.

BIGINT - A large integer that can be signed or unsigned. If signed, the allowable range is from -9223372036854775808 to 9223372036854775807. If unsigned, the allowable range is from 0 to 18446744073709551615. You can specify a width of up to 20 digits.

For more details, refer to MySQL Data Types.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.