Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm getting the primary key problem (I've read TW doesn't seem to recognize primary key, btw).
The primary key definition from Schema for my import table is:
'primary key' => array('Array'),
which is clearly cackked given that all the other ones look something like:
'primary key' => array('did'),
Since you depend on Schema it's looking like the problem is over there, not in TW.
Comments
Comment #1
aangel CreditAttribution: aangel commentedI think I've isolated the problem in tw.module line 438.
Schema returns the primary key as the zero-eth array element of $schema['primary key'] but TW is performing this test:
if (in_array($colname, $pks))
expecting the primary key index name to be where the zero-eth element is instead.
Changing line 336 which currently reads:
to read:
allows TW to correctly identify the primary key.
Not knowing the code well enough, I'm not sure if Schema is setting up the wrong structure or if TW is expecting the wrong structure. Hope this helps.
Now that I can get past this error, I'll try my import tomorrow.
Comment #2
mikeryanI can't reproduce this with either a single-column or two-column primary key, and adding [0] breaks it for me - is there any more info you can provide? $schema['primary key'] should be an array of the fields in the primary key, there shouldn't be an intermediate array.
Comment #3
sdsheridanThe problem appears to be that "maxvalue" is a reserved word in MySQL 5.5 and up (perhaps earlier, but not apparently as early as 5.1), so without surrounding it in back-quotes, the insert or update fails for all numeric types. However, using "drupal_write_record", that doesn't seem to happen in the code per all the API documentation as far as i can see, so it's failing on the inserts and updates.
Solution: change the column name (best solution i think), or don't use "drupal_write_record" to do the updates...
Shawn
Comment #4
Alex Andrascu CreditAttribution: Alex Andrascu commentedThis is closely related to #418464: TW doesn't seem to recognize primary key
Comment #5
Alex Andrascu CreditAttribution: Alex Andrascu commentedI won't create another issue for this but please fix the existing ones so we can get this working on MySQL 5.5
Thank you,
Alex
Comment #6
MixologicThis is fixed by getting rid of 'maxvalue' here: #1100896: Reserved SQL keywords being used
Comment #7
Mixologic