Problem/Motivation
Some the kerneltests install entity schema's, install module configuration and create content. MongoDB is a bit stricter in the order of execution those actions. For MongoDB first the entity schema's need to be installed. Next the module configuration can be installed. Only then can content be created. With MongoDB entity fields are stored in the JSON document. Creating entity fields without the entity schema being installed will result in an error like:
Exception when installing config for module node, message was: Exception thrown while performing a schema update. Cannot add embedded table node_all_revisions__body to the node_all_revisions, because node_all_revisions doesn't exist.
MongoDB is also stricker in having dependent modules being installed. For instance the media entity has a dependecy on the user module. When the user module is not installed and the user entity schema installed, you get the following error:
Drupal\Core\Field\FieldException: Field 'revision_user' on entity type 'media' references a target entity type 'user' which does not exist.
Proposed resolution
Change the order of installing entity schema's, installing module configuration and content creation.
Remaining tasks
TBD
User interface changes
None
Introduced terminology
None
API changes
None
Data model changes
None
Release notes snippet
None
| Comment | File | Size | Author |
|---|
Issue fork drupal-3475719
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
daffie commentedComment #4
johnwebdev commentedComment #5
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #6
daffie commentedRerolled the MR. Back to RTBC.
Comment #7
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #8
daffie commentedRebased and back to RTBC.
Comment #9
alexpottNot sure how this is going to be maintained unless mongo is in core :)
Maybe it is possible to add a listener in kernel tests to ensure that the entity schema is installed before creating a field on it?
Comment #10
daffie commentedI have added a listener to the kerneltestbase class and found a new instance were an entity schema was not created: Drupal\Tests\layout_builder\Kernel\ConfigActionsTest. The test was added a week ago in #3486981: Allow recipes to enable Layout Builder via config actions.
@alexpott: Thank you for the review and your suggestion how to make it better.
Comment #11
mondrakeThis is very nice regardless of MongoDb in its enforcing proper dependencies of actions.
Is it possible to add a test for the new subscriber? More comments inline in the MR.
Comment #12
daffie commentedAll remarks on the MR by @mondrake have been addressed.
A test has been added for the new field storage create check subscriber.
Back to NR.
@mondrake: Thank you for the review.
Comment #13
mondrakefew more nits commented inline
Comment #14
daffie commentedApplied the requested changes.
@mondrake: Thanks for the review.
Comment #15
mondrakeNice! LGTM now. Triggered tests for SQLite and PgSql.
Comment #16
alexpott@daffie the event listener turned out great! Think we need to make a small adjustment for non core tests and trigger a deprecation until Drupal 12. See MR for suggestion for how to do this.
Comment #17
daffie commentedThe requested warning has been added for non-core tests.
Back to NR.
@alexpott: Thank you for the review.
Comment #18
alexpott@daffie the changes look great. Will commit once this is rtbc again
Comment #19
mondrake#16 is addressed, back to RTBC
Comment #20
alexpottCommitted 7f54341 and pushed to 11.x. Thanks!