Closed (fixed)
Project:
Dynamic Entity Reference
Version:
8.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Nov 2017 at 17:33 UTC
Updated:
26 Dec 2017 at 00:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nick.james commentedI started to create a test for the update hook, however, I realized a new data snapshot would need to be generated after
dynamic_entity_reference_update_8201was run. The reason is the DER fields in the current snapshot do not have atarget_id_intcolumn in the database. Oncedynamic_entity_reference_update_8201is run, the field is added and the fix in this patch works as expected by adding an index on the new column. However, it prevents us from doing an isolated test to confirm that the update hook in this patch works as expected and creates the index on any existing DER fields that already have thetarget_id_intcolumn.I'm also not sure about all the test cases that need to covered for this change. But I thought I would at least provide the solution I have so far.
Comment #3
jhedstromShould this index instead of just being on the `_int` column, be on the entity type and the int column (as the normal index for this field is on the target ID and on the entity type column)?
Comment #4
nick.james commentedComment #5
nick.james commentedComment #6
jibranComment #8
nick.james commentedComment #9
jibranThanks, for working on this. We need tests for this change and we also need upgrade path tests for this.
Can we please move the static part of this array outside the loops?
Comment #10
jhedstromThe failures look related to #2754217: Random Test Failure with "failed to open stream" for temporary://.htaccess.
Comment #11
jhedstromThis adds an update test, as well as 2 tests under the normal kernel tests to verify the index is created. I've attached those as a test-only patch as well. The interdiff does not contain the new starting db. (Note, to test the actual update hook, a new starting db was needed since if we started with the current update db, that actually adds the _int column, so the index is created during that update instead).
Comment #13
jibranThanks, for this comment. Should we add assert in 8201 tests as well?
Comment #14
jibranCan you please share the DB generation script as well?
Comment #15
jhedstromThis is the db test script (I copied it from the other issue https://www.drupal.org/node/2555027#comment-11307815). The steps are the same:
drush scr test.phpphp ./core/scripts/dump-database-d8-mysql.php --no-ansi > modules/dynamic_entity_reference/tests/fixtures/update/update_test_8202.phpgzip modules/dynamic_entity_reference/tests/fixtures/update/update_test_8202.phpComment #16
jhedstromComment #17
jhedstromComment #18
jhedstromThis adds those assertions to the previous update test.
Comment #19
jhedstromOops, I missed one.
Comment #20
jibranThanks, I'll have a look at
FieldStorageSubscriberin detail after these changes and commit it..
Comment #22
jibranI reviewed the changes thank you @nick.james and @jhedstrom for finding and fixing this. Committed and pushed to 8.x-2.x. Fixed following CS issues on commit. I'll create a new release soon.