make_group_revisionable db update fails

Created on 20 July 2021, over 3 years ago
Updated 30 November 2023, 12 months ago

Problem/Motivation

After updating the module to the latest version(8.x-1.4), these are some database updates available. make_group_revisionable update fails.

Steps to reproduce

1. Update to 8.x-1.4 version
2. Run drush updb

See comments below. The error is related to lightning_workflow or lightning_scheduler as a dependency. A patch for lightning_workflow is linked. A similar patch needs to be created for the standalone version of lightning_scheduler.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Version

1.4

Component

Code

Created by

🇮🇳India saurabh-2k17

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇦Ukraine o_timoshchuk

    I had the same issue and found two empty revision tables in the database. To resolve it, I created a patch.

  • 🇮🇳India kanchamk

    I updated the group module from 1.2 to 1.6 and got the below error. Any idea?

    >  [notice] Update started: group_post_update_make_group_revisionable
    >  [error]  Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.tmp_2d4eecgroup_r__e3b0c44298' doesn't exist: INSERT INTO "tmp_2d4eecgroup_r__e3b0c44298" ("entity_id", "revision_id", "bundle", "delta", "langcode", "field_learning_path_duration_target_id") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array
    > (
    >     [:db_insert_placeholder_0] => 67
    >     [:db_insert_placeholder_1] => 67
    >     [:db_insert_placeholder_2] => learning_path
    >     [:db_insert_placeholder_3] => 0
    >     [:db_insert_placeholder_4] => de
    >     [:db_insert_placeholder_5] => 630
    > )
    >  in Drupal\Core\Entity\Sql\SqlContentEntityStorage->saveToDedicatedTables() (line 1403 of C:\xampp\htdocs\opigno-composer\web\core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php).
    >  [error]  The entity update process failed while processing the entity type group, ID: 67.
    >  [error]  Update failed: group_post_update_make_group_revisionable
    
  • 🇨🇦Canada joseph.olstad

    @kanchamk, please make a backup of your dump file before trying this.

    drush sqlq 'drop table if exists groups_revision;';
    drush sqlq 'drop table if exists groups_field_revision;';
    
  • 🇮🇳India kanchamk

    @joseph, These tables groups_revision and groups_field_revision did not exist in the database in the first place even after upgrading the group module from 1.2 to 1.6. Attached screenshot for reference.

  • 🇨🇦Canada joseph.olstad

    @kamchamk, if you look at my explanation , I'll repeat again what I did myself to fix this.

    #24

    In my case I actually had more luck removing lightning by using fake lightning modules that I generated with drush gen module.

    once I used the fake lightning* modules I was able to complete the schema upgrade and then uninstall lightning but for each site will be different challenge if your custom modules require lightning you'll have to unravel that. Also lightning brings in some other modules you may need a composer require for those.

    Before I elaborate, please check to see if you're using any module who's name starts with "lightning" or "Lightning"

  • 🇮🇳India kanchamk

    I don't have any modules starts with lightning installed. FYI, I am using <a href="https://www.drupal.org/project/opigno_lms">opigno_lms 3.2.7</a>. Recently migrated opigno_lms from 3.1.0 to 3.2.7

  • 🇨🇦Canada joseph.olstad

    This table: tmp_2d4eecgroup_r__e3b0c44298 is a strange one that I've never seen or heard of, is this expected by the hook_update? check the group.install code
    which hook_update is failing?

  • 🇨🇦Canada joseph.olstad

    Good luck on this @kamchamk , you may want to instead switch to group 2 or version 3 instead and try upgrading to those instead.
    check the release notes.

  • 🇮🇳India kanchamk

    @joseph, I can't update group module as opigno_lms has fixed its group dependency version to 1.6. This is failing in post_update function group_post_update_make_group_revisionable in group.post_update.php

  • 🇨🇦Canada joseph.olstad

    The word "Can't" doesn't exist in my Drupal vocabulary.

    override opigno_lms in your composer.json file as follows:

    Add a line to your require section
    drupal/group: "3.2.2 as 1.0.6"

    or, for 2.x

    drupal/group: "2.2.2 as 1.0.6"

    Then run composer up drupal/group

  • 🇮🇳India kanchamk

    I was able to resolve this issue by doing the following:

    • Go to /admin/group/types/manage/learning_path/fields , here learning_path is my group type.
    • "Edit" every field and click on "Save" to update the field.
    • Run drush updb again. This error issue was resolved and now group fields are revisionable

    @joseph, thank you for your help.

  • 🇨🇦Canada joseph.olstad

    Very cool, thanks for the followup, that is good to know in case I come accross another project that needs upgrading your trick may come in handy.

  • 🇺🇸United States firstlut

    I am updating Opigno LMS, as well, and I tried the "edit fields" trick, and that merely changed the nature of the error. Then I got an error that the preUpdateEntityTypeSchema function in SqlContentEntityStorageSchema.php was getting mismatched arrays. There was one field that wasn't getting a corresponding revision field created.

    I deleted the offending field for now just so I could move on, but I'll have to address it eventually.

Production build 0.71.5 2024