So I have a custom module with a module.schema file, defining a configuration schema for that module, not talking about database/field schema.

type: config_object
label: 'Settings for Module'
   type: sequence
   label: 'Ids from config'
    type: string
    label: 'ids'

I provided a module.settings file like:

 - 1
 - 2
 - 3
 - 4

As you can see, my mistake is that I needed a type: int in my schema not type: string.

On the configuration synchronization page I see Drupal has taken care of this and corrected this in its active configuration, by setting string values for "my_ids", and of course producing a diff between the staged and active configuration. The active conf has now strings:

 - "1"
 - "2"
 - "3"
 - "4"

I would like to update the schema of that configuration to int, without re-installing that module.Is this possible.

Tried to write to schema service in an update hook like:

  $name = 'module.schema';
  $path = '/home/user/Drupal/docroot/modules/module/config/schema';
  $source = new FileStorage($path);
  /** @var \Drupal\Core\Config\ExtensionInstallStorage $active_schema */
  $active_schema = \Drupal::service('config.storage.schema');
  $active_schema->write($name, $source->read($name));

But it turns out that "Write operation is not allowed." and that does not sound like a surprise.. :)

So is there another solution for this schema update, except re-installing the module?

Thank you.

  • 1
    Possible duplicate of How to update the database schema without losing existing data
    – leymannx
    Commented Nov 29, 2018 at 12:56
  • Thanks @leymannx, I think its not, im talking about configuration schema and not field schema, but I may be wrong
    – Pan Chrono
    Commented Nov 29, 2018 at 12:59
  • 1
    The database schema is something different.
    – apaderno
    Commented Nov 29, 2018 at 14:45
  • 1
    See hook_post_update_NAME which allows to modify configuration. You would change the schema in code, and write a post update to modify existing config I think. Theoretically...
    – mradcliffe
    Commented Nov 29, 2018 at 18:22
  • 1
    The schema is a file provied by your module, just like routing.yml, permissions.yml and so on. You don't have to update that, it just needs a cache clear. If you do want to update something, then you could update the actual config with the regular config API, but not sure that's really worth it, as you said yourself, the next resave should take care of it.
    – Berdir
    Commented Dec 1, 2018 at 0:08

2 Answers 2


I think everything you need is here: https://www.drupal.org/docs/8/api/update-api/updating-configuration-in-drupal-8

The second example should be your case


Well it turns out I spent some time here because I tried to update the schema file, by typing int not integer LOL. All I needed was integer and clear caches after all :)

Your Answer

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

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