Problem/Motivation

This is the comeback of #2527816: Logic error in SqlContentEntityStorage::countFieldData() attempts to drop `name` column. Turns out, we forgot to do the same fix as we did there for dedicated field tables above.

And in a way, it is worse because we *actually* lose data. If you have a record in there for uid 0 (which shouldn't really happen but for some case I do have it at least in one table), then it just drops the table and re-creates it and your content is gone.

Proposed resolution

Apply the same check to the query as we have for the shared tables.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir created an issue. See original summary.

Berdir’s picture

Status: Active » Needs review
Issue tags: +Needs tests
FileSize
990 bytes
catch’s picture

Issue tags: +beta target, +D8 upgrade path
jhedstrom’s picture

Berdir’s picture

Yes, that's exactly what we should do. Might get to do that in a few hours, will assign the issue to me then. If someone has time to look into this now, go for it!

jhedstrom’s picture

Assigned: Unassigned » jhedstrom

I'll work on the test.

jhedstrom’s picture

Here's a test.

The last submitted patch, 7: 2559309-07-TEST-ONLY.patch, failed testing.

Berdir’s picture

Status: Needs review » Needs work
+++ b/core/modules/field/src/Tests/FieldDataCountTest.php
@@ -146,6 +146,20 @@ public function testEntityCountAndHasData() {
+    $field_storage = entity_create('field_storage_config', array(
...
+    entity_create('field_config', array(

I think we spent quite some time dropping entity_create() calls, let's switch to FieldStorageConfig::create() and so on.

Berdir’s picture

Status: Needs work » Needs review
FileSize
2.85 KB
1.18 KB

Updated that.

plach’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

And STAY fixed this time. ;)

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 7ea136e on 8.0.x
    Issue #2559309 by Berdir, jhedstrom: Logic error in...

Status: Fixed » Closed (fixed)

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