4

The Drupal 7 {system} table has a schema_version column. Its default value is -1 as indicated by the DESCRIBE system; MySQL command.

Sometimes an update function won't run if the module's schema_version is -1. For instance, I have site that migrated from Drupal 6 to Drupal 7 quite some time ago. Recently I found that a database column that should have been introduced by honeypot_update_7100() never ran. I'm not sure whether or not the version of honeypot at the time of the migration contained that function. After changing the schema_version to 0, update.php ran that update and the missing column was introduced. See PDOException Column not found: 1054 Unknown column 'hostname' for similar stories.

Is -1 treated specially? Do all -1's potentially need to change to 0 for their update functions to run?

  • In the other question, the OP already knows what the -1 in that table means, and the answer for that question doesn't explain that. This question is not a duplicate of the other one. – kiamlaluno Apr 7 '17 at 5:09
4

-1 means the module is not installed. Updates are only run on installed modules, which is why any update in a module with a status of -1 will not run. If the module is coded properly, when the module is installed, it will be installed in the same level as if all updates had been applied, as updates are used to bring the database in line with the current definition of it in hook_schema().

  • Now I need to find out how a module that is enabled got -1. – htoip Apr 7 '17 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.