Problem/Motivation

The are two reasons why a field would be in a separate table, multiple values or if it is shared across multiple types.

Right now, the code checks for multiple *and* per-field, but it should be checking for multiple or per-field, but just checking for per-field storage should really be enough I think as well.

The table structure is also different as there's no delta, so we can't use fetchAllKeyed()*

* using fetchAllKeyed() is also a bug, as that only supports two columns, but we could have more than that. Should possibly be fetchAllAssoc(), would however affect the structure of the columns below, and it would need to be renamed anyway... But separate issue...

Proposed resolution

See patch :)

Works fine or on a real d6 site but needs tests.

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
Parent issue: » #2222375: Manual Testing: Nodes
FileSize
1.69 KB

And the patch.

Berdir’s picture

There shall be tests!

Had to fix a lot of stuff in the dumps, which were setting up things wrong/incomplete, field_test in fact already has two instances (but one for a non-existing node type), which means it should be using per-field storage, so changed that and using it as a test field for this, instead adding another field as a single field so that we also have test coverage for that part.

Also added support for multiple columns in per-field storage, it's a bit ugly but seems to be working, although there are a lot of variations that still don't have explicit test coverage, there are a lot of tricks for file fields but I don't think there are tests anywhere for that, for example..

The last submitted patch, 2: migrate-shared-fields-2262975-2-tests-only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 2: migrate-shared-fields-2262975-2.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
12.98 KB
3.28 KB

Fixing tests that relied on the field instance for the non-existing (in the source) article node type.

chx’s picture

Status: Needs review » Reviewed & tested by the community
core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php
37:        'type' => 'test_page',

ah-ha. Exceptional work, thanks so much!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks.

  • Commit 4e681e6 on 8.x by Dries:
    Issue #2262975 by Berdir: Fixed Non-Multiple field types with per-field...

Status: Fixed » Closed (fixed)

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