So I have a custom module with a module.schema file, defining a configuration schema for that module, not talking about database/field schema.
module.settings:
type: config_object
label: 'Settings for Module'
mapping:
my_ids:
type: sequence
label: 'Ids from config'
sequence:
type: string
label: 'ids'
I provided a module.settings file like:
my_ids:
- 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:
my_ids:
- "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.