Skip to content

Instantly share code, notes, and snippets.

@amaisano
Last active April 24, 2020 22:15
Show Gist options
  • Save amaisano/2d3896ea9ce7731f896d18c3b47bf63e to your computer and use it in GitHub Desktop.
Save amaisano/2d3896ea9ce7731f896d18c3b47bf63e to your computer and use it in GitHub Desktop.
Drupal 8 deploy trick
<?php
/**
* @file
* Allow post config updates to run.
*/
/**
* Implements hook_install().
*/
function exhibitor_relations_order_media_assets_install() {
// Reset the schema version, so our update hooks can be processed after installation.
$update_hook_names = [
'exhibitor_relations_order_media_assets_post_update_8001',
'exhibitor_relations_order_media_assets_post_update_8002',
];
$key_value = \Drupal::keyValue('post_update');
$existing_updates = $key_value->get('existing_updates');
foreach ($update_hook_names as $update_hook_name) {
$index = array_search($update_hook_name, $existing_updates);
unset($existing_updates[$index]);
}
$key_value->set('existing_updates', $existing_updates);
}
// In .post_update.php, the two mentioned updates above will then be processed using this deploy flow:
// drush updb --no-post-updates
// drush cim
// drush updb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment