If a database user does not have a create database permission, PostgreSQL will return ERROR 42501 (insufficient_privilege) when trying to create a database, even if it is already created anyway. MySQL seems to have similar behavior. This makes Ecto.Adapter.Storage.storage_up error, which in turn makes mix ecto.create fail.
Our application runs mix ecto.create before starting tests because we expected it to create the table with the default postgres superuser credentials, or just do nothing if the database already exists with custom credentials. However the latter is not the case if the user does not have a permission to create databases. While this is an easy application-side fix, I would expect mix ecto.create to not fail with the same config mix ecto.migrate works.
I've implemented a proof-of-concept patch for Postgres adapter in rinpatch@691d673 . If this behavior makes sense for the project, I can add tests and implement the same behavior for MySQL adapter.
If a database user does not have a create database permission, PostgreSQL will return ERROR 42501 (insufficient_privilege) when trying to create a database, even if it is already created anyway. MySQL seems to have similar behavior. This makes
Ecto.Adapter.Storage.storage_uperror, which in turn makesmix ecto.createfail.Our application runs
mix ecto.createbefore starting tests because we expected it to create the table with the default postgres superuser credentials, or just do nothing if the database already exists with custom credentials. However the latter is not the case if the user does not have a permission to create databases. While this is an easy application-side fix, I would expectmix ecto.createto not fail with the same configmix ecto.migrateworks.I've implemented a proof-of-concept patch for Postgres adapter in rinpatch@691d673 . If this behavior makes sense for the project, I can add tests and implement the same behavior for MySQL adapter.