This should be fairly easy.
The highlight to keep in mind
What when a import want to import an already existing serial number.
--> error dont import that line
This gives the possibility to non sequential serial numbers.
--> is no problem i think, if you now create 5 nodes and delete the 3th and 4th you also has non sequential serial field values.
The important part is that after the import there needs to be a check to test if the highest imported value for the serial field is still lower than the current auto_increment field in the database.
-->If not update the auto_increment to the highest imported serial field
Our use case:
We have a new system using drupal and use serial field extensively. We need to import data from the old system and are using feeds.
There are a lot of enity references involved, a lot of content-types, a lot with 1 or more serial fields.
We know of our import that every serial field is unique
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | serial-feeds-support-2480035-10.patch | 3.44 KB | skylord |
| #7 | serial-feeds-support-2480035-7.patch | 2.84 KB | eric_a |
| #7 | interdiff-2480035-4-7.txt | 1.37 KB | eric_a |
Comments
Comment #1
manuelBS commentedDid you already solve this issue?
Comment #2
Parkes Design commented+ 1 has any one come up with a solution for this yet?
Comment #3
ikeigenwijs commentedWe used a workaround.
We added dummy entries for the missing serial fields and removed them after the import.
The imported rows in the files then correlated with the serial field value that was created.
This was possible to the small number of gabs.
For other entries we just reassigned the new numbers we where in a move/reorganization anyway so it was a small extra effort.
I still think the feature would be valuable.
Comment #4
eric_a commentedHere's a start.
Comment #5
eric_a commentedComment #6
eric_a commentedJust found out that ID tracking/reserving is broken when importing items with feeds. I'll provide a fix in this issue later.
Comment #7
eric_a commentedHere we go. This fixes ID tracking for imported values, so that manually created nodes cannot re-use those values. There's no further logic, a feeds importer can do whatever it wants, wether the value existed or not.
Comment #8
yazzbe commented#7 seems to work fine.
patched against 7.x-1.8
Comment #9
eric_a commentedWell, to be honest, "optional_unique" and "unique_callbacks" do need to be implemented.
Comment #10
skylord commentedActually, default "unique_callbacks" implementation from Feeds API example can be used. Works OK for me on feed with about 20k entries (11 was with duplicated serial field successfully updated using it).
Comment #11
FireHawkX commentedTested patch #10 and it worked perfectly. Was able to import thousands of numbers in the serial field, and when it was all imported, serial started after the latest number added!