I am trying to update a module on an old project of mine. In the meantime the module's devs added new configuration and schema yaml files but did't write the update functions for already existing sites.

How would you import all schema and config changes automatically? Do I need to import the yaml files though Yaml::parse and then use \Drupal::configFactory() and \Drupal::entityDefinitionUpdateManager() in my hook_update_N function? Or is there an easier way?

1 Answer 1


If you have no data then reinstall the module.

If you want to keep the data then this depends what you have changed in the configuration. You can try how far you can get with the method you've described. If you only add fields, this will probably work. Also minor changes to a field can work. But if you change how a field is stored in the database this will not work.

The official way to do this is described here https://www.drupal.org/node/2554097.

  • Nah, it's more like the module added a completely new config entity and new config keys and I'm not sure how to use entityDefinitionUpdateManager for the former and how to import all those new configs automatically
    – alexej_d
    Dec 23, 2016 at 9:16
  • I don't think you can do this automatically. You have to do this in code. Get the old config and store it in the new config entity. You probably need to do this in two steps. In the old version you have the old entity class, here you can export. In the new version you have the new entity class, here you can import.
    – 4uk4
    Dec 23, 2016 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.