Add a command, to update a fields schema definition to the latest definition

Created on 25 March 2024, 3 months ago
Updated 28 March 2024, 3 months ago

Problem/Motivation

There is no command, to update a fields schema definition to the latest definition. See https://git.drupalcode.org/project/drowl_paragraphs/-/blob/4.x/drowl_par... for help.

Steps to reproduce

Proposed resolution

Add a command, to update a fields schema definition to the latest definition

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Grevil
  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    Hey, I've been looking out for a way for Drupal to be able to do the kinds of structure changes and data migration that django does.

    https://docs.djangoproject.com/en/5.0/topics/migrations/

    Is that the direction this project is going in?

  • πŸ‡©πŸ‡ͺGermany Grevil

    Hey @mortona2k! Glad you find interest in this little helper module!

    If I understand the django migration page correctly, it is! Currently in Drupal, there is no proper way, to modify existing fields on field storage / database level. For example, if you want to modify the (machine) name of a given field or update the storage definition in some other way. Data needs to be changed on field storage, field config, field instance and database level.

    Unfortunately, the already existing command is not perfect (yet). "third_party_settings" and other config keys that have the old field name set as their value, entity_reference fields and field translations do not "migrate" properly yet.

    Hopefully, at some point, Drupal core will have some more sophisticated helper methods. But until then, this little module needs to do the heavy lifting.

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    For example, if you want to modify the (machine) name of a given field or update the storage definition in some other way. Data needs to be changed on field storage, field config, field instance and database level.

    That's exactly what I'm looking for. I've never used django, but I heard about this capability and I thought it would be great for Drupal.

    The bigger vision is a UI to facilitate changes, like you have a change field form, and depending on what you're changing to, it gives options on how to transform the data.

    Migrate sandbox might be a solution in the middle. I haven't used it yet, but it looks like developers can create and run migrations in the UI with some tools to help build it and review results.

Production build 0.69.0 2024