Score:0

How can you update a single configuration entity using drush?

in flag

Every now and then, if I try to import partial configs using drush, like

drush config:import --partial --source=stuff/is/here

drush seems to understand that some of these config entities exist in the database, and it needs to update them.

+------------+---------------------------------------------+-----------+
| Collection | Config                                                        | Operation |
+------------+---------------------------------------------+-----------+
|            | migrate_plus.migration_group.foo_migrate                      | Create    |
|            | migrate_plus.migration.upgrade_d7_node_complete_article       | Update    |
|            | migrate_plus.migration.upgrade_d7_taxonomy_term_article_types | Update    |
+------------+---------------------------------------------+-----------+

I was assuming because it noticed the uuid in the files matches those in the database. But if I try exactly the same command the second time, it will only say 'Create', and when I execute it, it throws an error saying they already exist.

The behaviour actually seems the same if I remove the uuid from the yml files.

I like to be able to edit, update, edit, update, without having to manually remove these entities (or reverting the database). Is that possible ? How ?

john Smith avatar
gr flag
config:import --partial cannot delete, therefore you will have to manually remove
commonpike avatar
in flag
thanks. but apparently, it can update ? that would be good enough. how does it known when to update ?
john Smith avatar
gr flag
yes, you can actually lookup what it does [Drush ConfigImportCommands](https://github.com/drush-ops/drush/blob/12.x/src/Commands/config/ConfigImportCommands.php) and you see it uses `Drupal\Core\Config\StorageComparer` where you find stuff like `The entity has the same file as an existing entity but the UUIDs do not match. This means that the entity has been recreated so config synchronization should do the same.`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.