So I’ve got a brand new ecto repo, and I’m following the instructions here: https://hexdocs.pm/ecto/getting-started.html.
After configuring everything like so:
use Mix.Config
config :osdi, Osdi.Repo,
adapter: Ecto.Adapters.Postgres,
database: "osdi_repo",
username: "postgres",
password: "postgres",
hostname: "localhost"
config :osdi, ecto_repos: [Osdi.Repo]
And running
mix ecto.create
I get:
** (Mix) The database for Osdi.Repo couldn’t be created: FATAL 3D000 (invalid_catalog_name): database “postgres” does not exist
18:06:39.552 [error] GenServer #PID<0.152.0> terminating
** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name): database "postgres" does not exist
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
After psql
ing and running create database osdi_repo;
, I got the same result. After psql
ling and running create database postgres;
, I got:
The database for Osdi.Repo has already been created
Why is ecto / postgrex trying to create the database postgres
instead of osdi_repo
? Even if I change username and password to not be postgres, it still tries to create postgres, even after cleaning and recompiling.
Any ideas?