I’m trying to connect Ecto to a database (for local development) to which I have read-only access - I don’t want, nor can, issue any
CREATE statements. The problem is that when I send the request to a controller, I get following error:
[error] #PID<0.631.0> running Phoenix.Endpoint.SyncCodeReloadPlug (connection #PID<0.630.0>, stream id 1) terminated Server: localhost:4000 (http) Request: POST /... ** (exit) an exception was raised: ** (MyXQL.Error) (1142) CREATE command denied to user '...' for table 'schema_migrations' query: CREATE TABLE IF NOT EXISTS `schema_migrations` (`version` bigint, `inserted_at` datetime, PRIMARY KEY (`version`)) ENGINE = INNODB (ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:1047: Ecto.Adapters.SQL.raise_sql_call_error/1 (elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2 (ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:1154: Ecto.Adapters.SQL.execute_ddl/4 (ecto_sql 3.10.2) lib/ecto/migrator.ex:756: Ecto.Migrator.verbose_schema_migration/3
The table does exist in fact but Phoenix doesn’t check beforehand, banking on
IF NOT EXISTS to cover both cases.
I’ve tried setting
read_only: true to my repo, but didn’t help.
Can I somehow work around this?