In multiple attempts to deploy a fresh phoenix app, I get the following error:
[error] Could not create schema migrations table. This error usually happens due to the following:
* The database does not exist
* The "schema_migrations" table, which Ecto uses for managing
migrations, was defined by another library
* There is a deadlock while migrating (such as using concurrent
** (Postgrex.Error) ERROR 42501 (insufficient_privilege) permission denied for schema public
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:913: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
Starting clean up.
Before attempting to deploy, I ran mix ecto.create without running ecto migration yet.
I’ve also deleted the previous fly launch artifacts and started allover again without success. Please, any way to fix this problem?
If you compare with a newly generated Phoenix 1.6 application and deploy that, your fly.toml file should include this line:
release_command = "/app/bin/migrate"
This assumes the migrate script is present in the Dockerfile. The Dockerfile is created during fly launch
What this does is run migrations before starting your app. If this early step is failing, then check that the db username and password used by the application has permission to create tables. By default it should. This would only be the case if you are restricting access.
I don’t think I am restricting access in any way. Perhaps I should comment out the release_command = "/app/bin/migrate" part since I am not ready for migration just yet. Please, would that be the right approach?
Just want to have a “Site Under Construction” page on my Fly.io site for now.