Over the weekend I spun up a new Elixir :ecto, "2.2.7" project that I was able to get working with CockroachDB and this adapter fork - with some caveats I wanted to share to help others.
-
Only the
rootuser can create databases This requires you configure theEcto.Adapters.Postgresusernameasrootor else themix ecto.createcommand will always fail. You can go back and change your configuredusernameto something else after the database has been created, or create your database and user permissions usingcockroach sqland skip themix ecto.createcommand. -
Configuring Ecto primary_key ID to be created by CockroachDB By default when configuring your
Ecto.Schemausingautogenerate: falseit appears either CockroachDB, Ecto or the Postrex adapter (I did not investigate this) uses theBIGINTunique_rowid()function as the default value for IDs
@primary_key {:id, :id, autogenerate: