There is now a "serial" column which is a unique index for webform_submissions table. You can't assign a default, and you can't have not a default (because it's unique). For now, I'm getting around this simply by using sid from the source table. I doubt this will cause any problems, but who knows?

Comments

dags’s picture

I "fixed" this issue by adding the following line to the submissions.inc:

$this->addFieldMapping('serial', 'sid');

I think we can come up with a better solution though. I looked over the webform code and found that the serial field starts at 1 and increments by 1 as new entires are added to the table. Why the field doesn't auto_increment itself I don't know... but there is a column on the `webform` table called 'next_serial' that holds the serial value for the next submission. So if there is only 1 submission, then 'next_serial' holds 2.

mausolos’s picture

It doesn't auto increment because you can only have one auto increment column, and it has to be the primary key.

Another solution is to just allow serial to be NULL (which I did, manually, after my previous solution didn't work on another subsite).

techninja’s picture

Status: Active » Needs review
StatusFileSize
new384 bytes

Here's a patch for #1. Tested and works fine for my use cases.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

I checked out a couple options here and the proposed option seems the best. Calling _webform_submission_serial_next_value() directly in prepare_row() resulted in duplicate serial ids. Probably a bug in _webform_submission_serial_next_value due to race conditions. Regardless, it seems safe to use sid.

heddn’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Related issues: +#2390317: Rows are ignored if external node migration is used