I'm new to drupal. I need to write a module that need to handle user related details.
I'm able to create the module and add the necessery database changes in 'users_field_data' table. by using db_add_field in hook_install()
db_add_field('users_field_data', 'user_office', array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
));
But one thing I noticed when installing some other module from drupal is when a new field is added to the database it saves some values to 'config' table and 'key_value'table.
Is there a way that I add the values to 'config' table and 'key_value' table when creating a new field in an existing table in drupal 8.
Adding fields to existing entities should be done using the field and field storage configuration entities.
Take the following steps to accomplish your goals: