- Issue created by @Luke.Leber
- πΊπΈUnited States apmsooner
@Luke.Leber, great question and one I need to prioritize as a documentation task soon. I'll put this on my list of todo's.
- πΊπΈUnited States Luke.Leber Pennsylvania
Re-triaged issue component to documentation, thanks!
- πΊπΈUnited States apmsooner
@Luke.Leber - I've made some progress in a separate branch: https://git.drupalcode.org/project/custom_field/-/tree/updater_service?r.... That branch provides a custom field updater service. Right now it only supports adding a new column and I'm not yet sure how to handle tables with existing data but the column does get added to the db and is reflected in the UI field settings. If you or anyone else wants to try out and offer some help, I think I can get this workable. To try the service in a custom module, add an update to yourmodule.install like the following example. This is nowhere near fit for a release obviously... but it's a decent POC to build off of (I think).
addColumn($entity_type_id, $field_name, $new_column_name, $data_type, array($options))
/** * Test adding a new column to custom_field. */ function mc_core_update_9045(): void { /** @var \Drupal\custom_field\CustomFieldUpdateManagerInterface $update_manager */ $update_manager = Drupal::service('custom_field.update_manager'); $update_manager->addColumn('node', 'field_custom', 'new_decimal_column', 'decimal', ['scale' => 3, 'precision' => 6]); }
- Status changed to Fixed
11 months ago 9:17pm 8 August 2023 - πΊπΈUnited States apmsooner
Documentation provided here for handling this with the new service provided in the upcoming release: https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib... β
- Status changed to Fixed
11 months ago 5:16am 9 August 2023