Problem/Motivation

On a client site I found that it was reporting that for the Invite entity the changed field needs to be installed

Steps to reproduce

Install the invite module on a d8/9 site with the code base prior to this commit https://git.drupalcode.org/project/invite/-/commit/35dca499367b7dd523505...
Then deploy the latest version and check the status page and see notice about the missing field schema

Proposed resolution

Add in upgrade step to install the changed field into the known schema in the system.

Comments

seamus_lee created an issue. See original summary.

seamus_lee’s picture

StatusFileSize
new658 bytes

Attached is an upgrade function that worked on my client site to resolve this problem

dale42’s picture

Status: Active » Needs work

Hi Seamus, feedback on your patch:

  • The code worked like a charm. It added the field if it didn't exist and didn't produce an error if it already existed. (See below for how I tested it)
  • According to the guidance in the function hook_update_N documentation, the function should be named invite_update_8101().
  • The patch does not apply. It gives me the error:
    error: invite/invite.install: No such file or directory.
    It appears you created the patch in the directory above the invite module:
    diff --git a/invite/invite.install b/invite/invite.install
    It should be created inside the module directory.
  • If you include a doc-block above the function, the update will have a comment when the database update is run. For example:
      /**
       * Insure the Invite entity Changed field exists in the database.
       */
    

    will produce:

      drush updb
      -------- ----------- --------------- ---------------------------------------------------------
       Module   Update ID   Type            Description
      -------- ----------- --------------- ---------------------------------------------------------
       invite   8101        hook_update_n   8101 - Insure the Invite entity Changed field exists in 
                                            the database.
      -------- ----------- --------------- --------------------------------------------------------
    

The commit you referenced happened in the 8.x-1.0-beta2 update so I tried testing an update from 8.x-1.0-beta1 to 8.x-1.0-dev. I found that 8.x-1.0-beta1 will not run in Drupal 9 (beta1 was released in 2017). I had to test the code by deleting the column in mysql and then running the update.

renatog’s picture

Status: Needs work » Active
StatusFileSize
new808 bytes

Hello everyone!

@seamus_lee thank you so much for your patch

In attachment the new one with @dale42 's points of #3 addressed

  • RenatoG committed c8e966e on 8.x-1.x authored by seamus_lee
    Issue #3254883 by seamus_lee, RenatoG, dale42: Missing field schema for...

  • RenatoG committed d4e3b3c on 2.0.x authored by seamus_lee
    Issue #3254883 by seamus_lee, RenatoG, dale42: Missing field schema for...
renatog’s picture

Status: Active » Fixed

Committed to the dev branches 8.x-1.x and 2.0.x

@seamus_lee thanks a lot and @dale42 thanks you so much for you great job in the Invite project

Best regards

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.