I have a custom field type that's been in use on several sites for a while now. I have updated this field type to add two additional columns to the schema. I'm struggling to find the correct way to write the update hook to implement this change.
I thought I was supposed to do this:
$entityDefUpdateManager = \Drupal::entityDefinitionUpdateManager(); // For now, just load the one storage definition that we know is using our custom field type. $def = $entityDefUpdateManager->getFieldStorageDefinition('field_ps_events_date', 'node'); $entityDefUpdateManager->updateFieldStorageDefinition($def);
But this throws an exception when something attempts to query the field storage tables and select the new fields that haven't been added yet!
Am I supposed to instead manually write the SQL statements that add the columns to every table and revision table? I tried that as well, but then Drupal still complains about "Mismatched entity and/or field definitions" on the status page.
Someone pointed me to an update hook in date_recur, but that update hook does not use the entity definition update manager service at all. What's the point of that service if it should not be used?