Problem/Motivation
Drupal core has a hook_update_N()
mechanism with which developers can fix the database. But often we also want to abuse it to deploy other changes. This can lead to the situation that we would like to import the configuration before running the update hooks. But this is a very bad idea and will not be possible in the future.
See #2762235: Ensure that ConfigImport is taking place without outstanding updates and #2628144: Ensure that ConfigImport is taking place against the same code base.
The use case for this is for example adding a new field and dynamically populating it during a particular deployment.
Proposed resolution
Add a hook_post_config_import_NAME
called after a config import so that developers can easily write one-off hooks for deployments and still always run the update hooks before the config import.
Remaining tasks
Port https://github.com/bircher/drupal-config_import_n to core and pass the import event to the hook.Update documentation (i.e. hook_install(), https://www.drupal.org/docs/8/creating-custom-modules/include-default-co... , etc.) to let developers know this hook is the right place for CRUD operations relying on the default configuration shipped with their modules.
User interface changes
none
API changes
new hooks.
Data model changes
none