I'm developing in a local environment, then committing/pushing changes to a Pantheon Dev sandbox. When I enabled this module and created a serial field on a content type (locally), it seemed to work fine when I exported the config settings and pushed them to Pantheon. But when I tried to create a node of that type, I got an error because the serial_xxxxxxxxxxxx table did not exist.

It seems that table isn't getting created during the config synchronization when the serial field itself gets created.

Comments

ExTexan created an issue. See original summary.

finn lewis’s picture

@ExTexan, I'm seeing the same. Did you get anywhere?

extexan’s picture

No fix for it as far as I know. I just have to create the appropriate table(s) manually via our MySQL client whenever we create a new Serial field. Fortunately, at this point in our dev cycle, most all the Serial fields have already been created.

mortona2k’s picture

In my site the tables did get created on config import, however the existing content didn't get a value generated.

mortona2k’s picture

Line 31 and 32 in serial.module:

function serial_field_config_create(FieldConfig $field) {
  if ($field->getType() == 'serial' && !$field->isSyncing() && !$field->isDeleted()) {...}

If the field is created via config sync, it will not run the code here that sets up values for existing fields. I think this check should be removed.

mortona2k’s picture

I don't mean to hijack the thread, I think we're seeing different issues although I am not affected by this specific one.

mortona2k’s picture

Have you checked if the module was included in your exported config? The tables are created in serial.install when the module is enabled.

extexan’s picture

@mortona2k, I'm not sure what you mean by this...

Have you checked if the module was included in your exported config? The tables are created in serial.install when the module is enabled.

Yes, the module was included in the exported config, months ago, and is installed/enabled in the Dev site (where we do the config sync after changing settings locally).

Your comment is confusing in that when the module is installed (and the serial.install runs) there can't be any serial fields yet in the site, so the installation process couldn't create those tables.

The situation I'm talking about is when we create a new serial field days/weeks/months after the module has been installed, then export the config, import it into our Dev site and do a config sync, the tables normally created by the serial field module are not created on Dev, as they were on my local site.

StefanPr’s picture

StatusFileSize
new1.67 KB

Had to change 2 things in order to make it work.

serial_field_config_create didn't run for config Syncs, which prevented the serial_xxx table from being created.

The old entities wouldn't always populate because the query was running access checks and access checks should be ignored in this part.

StefanPr’s picture

Status: Active » Needs review
anas_maw’s picture

I can confirm patch #10 work.

lisastreeter’s picture

Patch #10 is working for me. Thanks!

sandeepguntaka’s picture

#10 works perfectly for me as well.

anas_maw’s picture

Status: Needs review » Reviewed & tested by the community

  • colorfield committed 31b601c on 8.x-1.x
    Issue #2834714 by StefanPr, ExTexan, mortona2k, Anas_maw, finn.lewis,...
colorfield’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @all for the patch and the review! Pushed into dev

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.