I have built a custom module and there are two configuration files in config/install directory of my module. When the module is installed the configurations are installed correctly. When I uninstall the module and try to reinstall it, I get the error that that the `

fields already exist in the database

These fields are defined in the configuration files and I want that they should be installed only if they not exist.


1 Answer 1


Move them to config/optional instead.

In that case, they will only be installed if they don't exist yet and if all their dependencies are met.

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.