Score:3

Schema information for module is missing - how to fix?

in flag

I tried to install the Scheduler module but it did not install properly because we somehow did not have code for another custom module that the database thinks was installed. I got the code for the missing module.

My scheduler module is completely borked, as is my database. I cannot uninstall the module because there is a missing field in the database.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'publish_on' in 'where clause': SELECT 1 AS "expression" FROM "node_field_data" "t" WHERE "publish_on" IS NOT NULL LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1777 of /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

I tried to run update.php but I just get the following message with no way to actually run the update for the scheduler module.

Schema information for module scheduler was missing from the database.

You should manually review the module updates and your database to check if any updates have been skipped up to, and including, scheduler_update_8102().

How can I manually review the module updates and run them to get my database in sync, so I can at least use or uninstall the module?

Thanks!

in flag
It's easier to just roll back any code changes and load a DB backup. Then fix that issue about the missing custom module before trying again with the install.
in flag
The issue isn't with the custom module. It's with the Scheduler module. The Scheduler module didn't install properly because something else was missing. Now I can't delete or do anything else with the site because the schema is messed up with the Scheduler.
in flag
Can certainly guarantee it's not Scheduler. When you install a module, Drupal does other things as well (check if dependencies exist, check if plugins exist, _run hooks_, etc.). If any of those other things crash in the middle of installation, your install might end up incomplete. In this case, your install of Scheduler crashed at the time after it registered itself as enabled but before the schemas were updated. The question never mentioned what this custom module is, what it does, or how Scheduler is installed, or what other steps were taken, so we'll never really know what exactly happened.
in flag
Thanks for the info. I know what happened, and I know why it happened. The question remains -- WHEN this happens, how can I fix it? What's the point of having a message that says, "manually review the module updates" if there's no way to run the updates manually. If I could have found an easy way to run the install script for scheduler, it would have fixed the issue. Otherwise, modules shouldn't be dying on uninstall if they can't find table or schema information. There should be a method of garbage collection built in, at the very least.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.