Last active
November 21, 2019 10:54
-
-
Save achraf-jeday/9351c04a683761028e3cdd44ab357050 to your computer and use it in GitHub Desktop.
Drupal 8: To run a mymodule_update_8004() multiple times in development enivrements use these queries:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM key_value WHERE collection="system.schema"; | |
UPDATE key_value SET value='s:4:"8003";' WHERE collection="system.schema" AND name="mymodule"; | |
How to "revert" a custom module's update 'N value' | |
D7 only: If you need to execute an update hook another time when testing it locally you can "revert" a custom module's update 'N value' with: | |
UPDATE system SET schema_version = [last_successful_update_ID] WHERE name = '[name_of_module]'; | |
Replace the square brackets plus its content. See https://drupal.stackexchange.com/a/69841/19480. | |
Examples: | |
SELECT schema_version FROM system WHERE name = 'alpha_sierra_main'; | |
UPDATE system SET schema_version = 0 WHERE name = 'alpha_sierra_main'; | |
UPDATE system SET schema_version = 7000 WHERE name = 'alpha_sierra_main'; | |
Using drush through a Drupal API function, both valid for D7 and D8: | |
drush ev "drupal_set_installed_schema_version('[name_of_module]', [last_successful_update_ID])" | |
Or you could install the drush uroll module and do | |
drush uroll --module=[name_of_module] --version=[last_successful_udpate_ID] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment