application/config/mysql_history.sql
-- --------------------------------------------------------
-- Add simple_id
-- December 23, 2012
ALTER TABLE `transactions` ADD `simple_id` VARCHAR(255) AFTER `modified`;
$ drush updb
---------------- --------------------------------- --------------- -------------------------------------------------------------------------------
Module Update ID Type Description
---------------- --------------------------------- --------------- -------------------------------------------------------------------------------
system 8901 hook_update_n Update the stored schema data for entity identifier fields.
layout_builder override_entity_form_controller post-update Clear caches due to addition of service decorator for entity form controller.
---------------- --------------------------------- --------------- -------------------------------------------------------------------------------
...
$ drush cex sync
Differences of the active config to the export directory:
+------------+-----------------------------------------------------+-----------+
| Collection | Config | Operation |
+------------+-----------------------------------------------------+-----------+
| | system.all_the_things | Update |
| | layout.all_the_things | Update |
+------------+-----------------------------------------------------+-----------+
The .yml files in your export directory (../config/sync) will be deleted and replaced with the active config. (yes/no) [yes]:
>
Always version your database.
— K. Scott Allen
This means use the config management system, which could be at the site level, install profile level, or core/contrib level.
... it’s a little squishy.
What is clean configuration?
$ drush cim sync
$ drush cex sync
But, you can make it unmanaged.
Clean configuration means: The managed configuration in the database exactly matches that in version control.
GOOD:
$ drush config-status
[notice] No differences between DB and sync directory.
BAD:
$ drush config-status
----------------------------------------------------- -----------
Name State
----------------------------------------------------- -----------
system.site Different
----------------------------------------------------- -----------
Some examples:
Simply put, it is:
$settings['config_sync_directory'] = '../config/sync';
There is only 1 per site.
By default, all config exports to and imports from here.
Example: environment splits should be disabled, then enabled:
$config['config_split.config_split.dev']['status'] = FALSE;
$config['config_split.config_split.stage']['status'] = FALSE;
$config['config_split.config_split.prod']['status'] = FALSE;
$config['config_split.config_split.' . $env_name]['status'] = TRUE;
Your primary development branch is the canonical source of configuration.
All changes branch off the canonical and are merged back into it, just like any other code changes.
Consider a "reset" script that is run every time you change branches:
drush cim sync -y || drush cim sync -y
drush cim sync -y
Line 1: Import but allow it to fail using the ||
trick
(there are caching issues when modules are enabled)
Line 2 Import to reflect changes in how config is imported (config split)
I've not seen any indication this will change.
Drumroll, please...
Pick 1 synchronization model, layer on split models as you like.
$settings['config_sync_directory'] = '../config/sync';
$settings['config_sync_directory'] = "../docroot/profiles/custom/{$profile_name}/config/sync";
This is a symlink to ../config/{$profile_name}/sync
$settings['config_sync_directory'] = "../config/{$site_name}/sync";
You can't talk about config split models without getting into split types...
With each of the split examples, on a per-module or per-config entity basis you choose between these options:
All config imports and exports to synchronization directory.
Example: 12 content types, 10 are managed, 2 are unmanaged.
At least 8 should be in your default config set (synchronization directory).
Math: 8 / (12 - 2) = 80%
(This proxy guideline for how difficult it will be to manage the application.)
1 site: > 90% managed config ("Collectible" sites)
2-5 sites: 80% managed config
6-20 sites: 40% managed config
20+ sites: < 20% managed config ("Commodity" sites)
Env Splits | Site Splits | Profile Splits | Module Splits | |
---|---|---|---|---|
Globally Shared | ✅ | ✅ | ✅ | ✅ |
Profile Shared | ✅ | ✅ | 🚫 | ✅ |
Separate | ✅ | 🚫 | ✅ | ✅ |
Unmanaged | 🚫 | 🚫 | 🚫 | 🚫 |
Scenario | Use Case | # Sites | % Managed |
---|---|---|---|
Globally Shared with Site Splits | Same functionality, minor per-site differences | <10 | 100% |
Globally Shared with Profile Splits | Same functionality, minor per-install-profile differences | 20+ | 80% |
Profile Shared with Site Splits | Same functionality by install profile, minor per-site differences | 20+ | 80% |
Unmanaged | Same base functionality, large differences per-site | 70+ | 0% |
Environment splits and module splits can be used with any managed setup.
With each of the split examples, on a per-module or per-config entity basis you choose between these options:
Please provide feedback:
events.drupal.org/global2020/sessions/models-configuration-management
Slides are available:
github.com/josephdpurcell
Let's talk! @josephdpurcell