Problem/Motivation

  1. Install a fresh copy of Drupal 8.4.x
  2. Make sure the history module is uninstalled.
  3. Create a view of node content with a page display.
  4. Add the "New comments" field to the view and save it.
  5. Visit the view and see "Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'd8.history' doesn't exist: ..."
  6. Be sad.

Proposed resolution

The proposed resolution/patch was to declare that the field handler is dependent on a module (other than the one implementing it).

Remaining tasks

  • (done) fix
  • (done) update tests (see #16)
  • (done) add missing history config (asked for in #9 and #10. done in #14)
  • add upgrade path (see #19)
  • review

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

mikeryan created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new3.49 KB

Here's a simple fix

andypost’s picture

StatusFileSize
new1.21 KB

Otoh it makes sense to disable the plugin when no history modules enabled

andypost’s picture

Issue tags: -Needs tests
StatusFileSize
new1.19 KB
new2.4 KB

And here's a test

The last submitted patch, 4: 2593869-4-fail.patch, failed testing.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Thank you, looks great

The last submitted patch, 4: 2593869-4-fail.patch, failed testing.

catch’s picture

Issue tags: +rc target triage

Looks good to me, and should go in during RC if possible, tagging for triage.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I think the Drupal\comment\Plugin\views\field\NodeNewComments plugin also needs to be adding a dependency on the history module so that a view which depends on it is listed when uninstalling the history module. Doing this will break the new test :)

alexpott’s picture

Issue tags: -rc target triage +rc target, +missing config dependencies

Discussed with catch and we agreed that this would be a nice bug to fix asap.

alexpott’s picture

Also @xjm is plus one too.

xjm’s picture

xjm’s picture

Sorry, my point in #12 was that #2591147: Filter criteria for views, option "Content is updated" - causes a SQL syntax error and this issue are fixing the same bug in different places, so it makes me wonder whether there is a fix that will fix both rather than special-casing comment all over the place in history views plugins.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1.59 KB
new3.26 KB

tested manually imported view, it's removed after uninstall but not in test...

Status: Needs review » Needs work

The last submitted patch, 14: 2593869-13.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new645 bytes
new3.28 KB

Fixing the test - you need to rebuild the router after uninstall - that would happen if part of a regular request.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Thanx a lot!

larowlan’s picture

+1

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

re #13 the fix in #2591147: Filter criteria for views, option "Content is updated" - causes a SQL syntax error is not really removing the comment dependency - it's just burying it behind some tricky to follow logic. The fix here makes the dependency on the history module of the NodeNewComments plugin explicit and therefore, I think this is the correct fix.

Quite how a user might discover that they get this additional functionality by installing the history module is another question that I have no idea how to answer.

Unfortunately we need an upgrade path because this is adding dependencies to views.

alexpott’s picture

The upgrade path can use the post update functionality and therefore use the Views and config entity APIs to fix all of this.

catch’s picture

Issue tags: +D8 upgrade path
xjm’s picture

Issue tags: -rc target

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new3.28 KB
new3.28 KB

Updating patch for 8.1.x and 8.2.x. hence interdiff isn't attached.

Status: Needs review » Needs work

The last submitted patch, 24: 2593869-24.patch, failed testing.

The last submitted patch, 24: 2593869-24.patch, failed testing.

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new4.15 KB
new887 bytes

Directly updating 8.2.x patch first.

Status: Needs review » Needs work

The last submitted patch, 27: 2593869-27.patch, failed testing.

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new4.15 KB
new991 bytes

Fixing typo for 8.2.x patch.

mohit_aghera’s picture

StatusFileSize
new4.15 KB
new888 bytes

Fixing errors for patch in 8.1.x branch.
Interdiff taken from #27 patch.

mohit_aghera’s picture

Version: 8.1.x-dev » 8.2.x-dev

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

KurtHiggins’s picture

Issue summary: View changes
Issue tags: +FLDC17

This bug is still present, I've updated the steps to reproduce issue to be more precise to triage the issue.

KurtHiggins’s picture

The patch applies, the patch resolves this error by making the field not available unless the history module is enabled.

KurtHiggins’s picture

yesct’s picture

Issue summary: View changes

updating remaining tasks

I'm not sure if the "missing config dependencies" tag should be kept so that we know config dep changed, or if that tag means there is a todo to add missing config dep. so leaving the tag.

larowlan’s picture

Issue tags: +Needs update path

Update path is next step here

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

sean_e_dietrich’s picture

Working on this as part of DrupalCon Nashville!

sean_e_dietrich’s picture

StatusFileSize
new5.44 KB

Issue still happening within the 8.6.x branch. Fixed issue with upgrade path using the suggestion of using hook_post_update_NAME.

Status: Needs review » Needs work

The last submitted patch, 42: 2593869-42.patch, failed testing. View results

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

lendude’s picture

Status: Needs work » Needs review
Issue tags: -missing config dependencies, -D8 upgrade path, -Needs triage for core major current state, -Needs update path
StatusFileSize
new13.63 KB
new14.68 KB

Needed a reroll, so did that.

Changed the update hook a bit, not convinced that turning on the history module and not removing the field is the right way to go here, but it is the least destructive, so let's go with that for now.

Added an upgrade path test, it doesn't check for the history module getting switched on because we don't have a dump where it's turned off and uninstalling it in the test does unexpected stuff to the view.
So just this for now.

Updated the tags a bit.

Status: Needs review » Needs work

The last submitted patch, 51: 2593869-51.patch, failed testing. View results

larowlan’s picture

+++ b/core/modules/comment/comment.post_update.php
@@ -14,3 +17,28 @@ function comment_removed_post_updates() {
+  if ($enable_history_module) {
+    \Drupal::service('module_installer')->install(['history']);

if we get this far, do we need to keep the batch running?

I.e should we set $sandbox['#finished'] = 1

edit: Yes, because we need the view's dependencies to be updated too

This is looking good to me, I'm not sure if we need an update path test to ensure the module is enabled, we already have the dependency test which is implicitly testing the update path.

We do however need to introduce the deprecation error this is introducing in the test

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.