Update Drupal 8 DB to allow Updates to be run again for testing and dev purposes

When working with Drupal 7 and indeed Drupal 8 we may sometimes need to run updates (hook_update) again. In Drupal 7 updating system table should have been sufficient. In D8 things are a little bit different.


Run a database update as follows:
  • SELECT collection, name, substring(value, 1, 2500) FROM key_value WHERE collection="system.schema" and name="modulenameinquestion"
    • The above will give us the last update hook that was run on this database.
  • UPDATE key_value SET value = 'i:9999' where collection="system.schema" and name="modulenameinquestion"

Hope this helps.

Comments

Popular posts from this blog

Use feeds module to import XML data in Drupal 7

Use ProxySQL to obfuscate data for development.

Using Wodby (drupal4docker) to create our local development environment.