Closed (fixed)
Project:
Drupal core
Version:
8.2.x-dev
Component:
entity system
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Apr 2016 at 15:27 UTC
Updated:
8 Jun 2016 at 07:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
larowlanComment #3
timmillwoodInitial patch for this.
Comment #5
timmillwoodComment #6
timmillwoodComment #7
timmillwoodAdded basic tests, and some of the fixes needed.
Comment #8
timmillwoodAdding update hook.
Comment #11
timmillwoodFixed the test
Comment #12
dixon_Patch looks really good.
I think it would be worth adding some kind of test just ensuring that
block_content_update_8003()works as expected for sites with existing content. However, I'm not sure how we easily can test update hooks in core?Comment #13
dixon_Comment #14
dixon_Comment #15
timmillwood@dixon_ - There are already over 40 tests that check for schema changes. So this kinda covers the
block_content_update_8003()update hook. If the update hook breaks / fails then all these schema tests will fail.Change record added https://www.drupal.org/node/2723393
Comment #16
timmillwoodComment #17
markdorisonTested the patch in #11 and it is working as expected.
Comment #18
alexpottIs this explicitly tested anywhere?
Comment #19
dixon_Schema hooks might be tested, but not the actual data update we perform this this specific update hook. And as we are touching people's data structure we need at least some kind of basic test to ensure it's doing what we think it does :)
Comment #20
dixon_Comment #21
dawehnerGiven the latest feedback.
Comment #22
dawehner.
Comment #23
timmillwoodAdding test to check revision_user and revision_created BaseFieldDefinitions are added in the update hook.
Comment #24
markdorisonTested #23. Working as expected for both a fresh install and update.
Comment #25
jibranThese asserts are not needed. Adding asserts to update tests before running updates turned out to be problematic in other issues.
Comment #26
timmillwoodTaking @jibran's advice.
Comment #27
jibranWe need a follow up to update
BlockContentViewsDatawithrevision_userrelationship to users table.Comment #28
timmillwood#2727343: Add test for views support for revision_user and revision_created fields in EntityViewsData created to track the views updates, thanks @jibran.
Comment #29
alexpottCommitted 4ac8f96 and pushed to 8.2.x. Thanks!
Couple of nits fixed on commit.
Comment #31
paranojik commentedI notices something that looks like an inconsistency introduced by this patch. On the schema level the two new fields 'revision_user' and 'revision_created' are added to the 'block_content_field_data' and 'block_content_field_revision' tables, whereas the existing 'revision_log' field remained in the 'block_content_revision' table.
I don't understand the schema details but still it seems really strange and also not consistent with the way revision metadata is handled for nodes. In the node's case all three revision metadata fields 'revision_log', 'revision_uid' and 'revision_timestamp' reside in the 'node_revision' table.
There's already an issue #2248983: Define the revision metadata base fields in the entity annotation in order for the storage to create them only in the revision table where this is being discussed.