Problem/Motivation

Schema on collect is not working properly, when testing something for collect_demo we get errors with missing dependencies and configurations that end up in an schema error.

This issue is related to the parent #2519966: Demo article is not displayed on the front page where the test will not run unless the schema error is fixed.

Proposed resolution

Go through the dependencies and configurations of collect and fix it. (add right ones)

Remaining tasks

Review.

User interface changes

API changes

Data model changes

Original report by [username]

Comments

juanse254’s picture

Status: Active » Needs review
StatusFileSize
new14.08 KB

This patch is directly related to #2532172: Schema errors for collect.model.email_message (inmail_collect), in order to be applied successfully the previous patch needs to go through. And this is also related to #2519966: Demo article is not displayed on the front page

juanse254’s picture

StatusFileSize
new14.08 KB
new451 bytes

Wrong patch, sorry. This is the right one.

The last submitted patch, 1: Schema_missing_inmail-2535094-1.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 2: Schema_missing_inmail-2535094-2.patch, failed testing.

juanse254’s picture

Waiting for the issue #2536258: Collect Client Web Test Failing to get fixed in order to retest.

berdir’s picture

+++ b/src/Plugin/search_api/datasource/CollectDatasource.php
@@ -161,4 +161,12 @@ class CollectDatasource extends DatasourcePluginBase {
+  /**
+   * {@inheritdoc}
+   */
+  public function calculateDependencies() {
+    return parent::calculateDependencies();
+  }

This doesn't do anything yet. It only works because we added the enforced dependency on search_api_index.collect_demo, but that shouldn't be necessary.

So you need to figure the enabled models and add them as dependency. See the implementation in ContentEntity data source as an example. When you've made sure taht works then you can remove the enforced part again.

juanse254’s picture

Status: Needs work » Needs review
StatusFileSize
new14.28 KB
new1.14 KB

Removed the enforced dependencies and updated the calculateDependencies().

mbovan’s picture

Status: Needs review » Needs work
+++ b/demo/config/optional/field.field.node.article.comment.yml
@@ -0,0 +1,33 @@
+    - field.storage.node.comment

+++ b/demo/config/optional/field.field.node.article.field_image.yml
@@ -0,0 +1,32 @@
+    - field.storage.node.field_image

+++ b/demo/config/optional/field.field.node.article.field_tags.yml
@@ -0,0 +1,26 @@
+    - field.storage.node.field_tags

I think we should have these config files in demo/config/install dir.

--- /dev/null
+++ b/demo/config/optional/editor.editor.full_html.yml

Wondering if we can replace this with filter.format.full_html as we don't have dependencies on ckeditor and editor.

juanse254’s picture

Status: Needs work » Needs review
StatusFileSize
new15.52 KB
new3.32 KB

Fixed :).

mbovan’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine to me.

berdir’s picture

Still a bit confused by this issue title and summary. There's not a single config schema change in this patch just dependencies and configuration.

Do we really need all those configs and fields for the demo? (comment field, image field and so on)

miro_dietiker’s picture

Status: Reviewed & tested by the community » Needs work

I was even unable to understand the problem and the proposal.

Sending back to work, possibly the issue needs to be discussed and a proper goal (issue, title, summary) needs to be defined.

juanse254’s picture

juanse254’s picture

Title: Schema missing with inmail_collect and collect_demo » Schema missing when testing on collect_demo which depends on several modules
Issue summary: View changes
mbovan’s picture

Do we really need all those configs and fields for the demo? (comment field, image field and so on)

In collect.model.article we have all these fields, so if we want to recreate an entity I guess we need them.

juanse254’s picture

Issue summary: View changes
juanse254’s picture

Status: Needs work » Needs review

Is it better that way?

miro_dietiker’s picture

Status: Needs review » Needs work

Did you forget to provide the patch?

berdir’s picture

No, the patch is still the same.

In collect.model.article we have all these fields, so if we want to recreate an entity I guess we need them.

Right.. In most other demo projects, we moved away from re-using the article node type and instead use our own. I'd recommend to do that here as well. The main advantage is that you can make it required configuration, so you will get an error if something is messing. Just rename article in all file names and in them to "collect_demo" or so, node type name could be "Collectable content" or something like that.

juanse254’s picture

Status: Needs work » Needs review
StatusFileSize
new19.95 KB
new19.78 KB

This might solve that.

berdir’s picture

Status: Needs review » Needs work

Yes, something like that. But let's move them to config/install now, so that there is an error if they can't be installed.

Also, see https://www.drupal.org/documentation/git/configure on how to set up git so that renaming files show up as rename which is a lot easier to review.

juanse254’s picture

Status: Needs work » Needs review
StatusFileSize
new22.82 KB
new22.27 KB

Moved all files but view.views.collect_demo because it seems like there is another issue related. Also filter.full_format which might be already installed in core.

Status: Needs review » Needs work

The last submitted patch, 25: Schema_missing_inmail-2535094-25.patch, failed testing.

juanse254’s picture

Status: Needs work » Needs review
StatusFileSize
new20.57 KB
new21.11 KB

Oh my bad, wrong patch.

miro_dietiker’s picture

Status: Needs review » Needs work
+++ b/config/optional/field.storage.node.comment.yml
+++ b/config/optional/field.storage.node.field_image.yml
+++ b/config/optional/field.storage.node.field_tags.yml

Me still confused: Why are those not in demo?

mbovan’s picture

What do you mean "not in demo"? If you mean why those files are not added in config/optional, then I guess we forgot to add them because we didn't have any demo tests. :)

miro_dietiker’s picture

I would expect that the fields above should be in the demo module shipped optional config. Not in the collect shipped optional config.

mbovan’s picture

Yeah, that's true. They should be in demo/config/optional.

mbovan’s picture

Status: Needs work » Needs review
StatusFileSize
new23.1 KB
new2.45 KB

Took a look at this... @Berdir pointed out that

  • field.storage.node.comment
  • field.storage.node.field_image
  • field.storage.node.field_tags

should be in demo/config/optional (because there could be the same storage files provided by core).

Consequently:

  • field.field.node.collect_demo.comment
  • field.field.node.collect_demo.field_image
  • field.field.node.collect_demo.field_tags
  • core.entity_form_display.node.collect_demo.default
  • core.entity_view_display.node.collect_demo.default
  • core.entity_view_display.node.collect_demo.rss
  • core.entity_view_display.node.collect_demo.teaser

should be also in demo/config/optional because they depend on something optional.

The other stuff can be in demo/config/install (including views.view.collect_demo) which required schema (search API query) fix.

Edit: Updated CollectDemoTest in #29 #2519966: Demo article is not displayed on the front page

Status: Needs review » Needs work

The last submitted patch, 33: schema_missing_when-2535094-33.patch, failed testing.

mbovan’s picture

Status: Needs work » Needs review
StatusFileSize
new21.79 KB
new1.31 KB

Here is the patch without CollectDemoTest included.

miro_dietiker’s picture

Status: Needs review » Fixed
+++ b/demo/config/install/collect.model.collect_demo.yml
@@ -8,9 +8,9 @@ dependencies:
+id: collect_demo
+label: collect_demo

label collect_demo => Collect Demo
Fixed on commit.

Note that the current module doesn't allow to reinstall collect_demo at all after an uninstall:

exception 'Drupal\Core\Config\PreExistingConfigException' with message 'Configuration objects                            [error]
(collect.model.collect_demo, collect.model.user, collect.model.web_resource, field.field.node.collect_demo.body,
node.type.collect_demo, search_api.index.collect_demo, search_api.server.collect_demo, views.view.collect_demo) provided
by collect_demo already exist in active configuration'

  • miro_dietiker committed 0069f6e on authored by mbovan
    Issue #2535094 by juanse254, mbovan, miro_dietiker: Schema missing when...
miro_dietiker’s picture

Status: Fixed » Needs work

The conflicting config on reinstall listed above should go to config optional.
Let's handle this as an update of this issue.

berdir’s picture

The problem with optional config is that it is a lot harder to debug when dependencies are missing.

The question, is what do you expect when you uninstall the demo module? that those indexes, node types and so on are kept or not? If not, then the answer is a forced dependency, not optional config.