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
root
user can create databases This requires you configure theEcto.Adapters.Postgres
username
asroot
or else themix ecto.create
command will always fail. You can go back and change your configuredusername
to something else after the database has been created, or create your database and user permissions usingcockroach sql
and skip themix ecto.create
command. -
Configuring Ecto primary_key ID to be created by CockroachDB By default when configuring your
Ecto.Schema
usingautogenerate: false
it appears either CockroachDB, Ecto or the Postrex adapter (I did not investigate this) uses theBIGINT
unique_rowid()
function as the default value for IDs
@primary_key {:id, :id, autogenerate: