Search code examples
flywaycontinuous-delivery

Automatic database creation


Flyway is really nice for migrating database, but it needs something to migrate.

An system might have addition and removal of applications each having their own database and credentials in a shared Postgres in Kubernetes for instance.

Manual setup by a sysadmin or developer is not an option.

What is the best practices for this, if any?


Solution

  • You should be able to achieve what you want with Flyway out of the box. You could create a new database using Flyway's initSql setting.

    Flyway will then automatically use the publicschema within that database, or if you specified a specific schema in the schemas setting it will create that for you as well.