I'll be writing about typical changes I make to the default phoenix project
NOTE: This article assumes you will using Ecto, and the database tables use UUID as the primary key.
- If you plan on running mix phoenix.gen.model to generate Ecto models, set the
generators
key to usebinary_id
for schema’s primary key.
config :portishead,
generators: [binary_id: true]
- For mix ecto.migrate with create table syntax, set the
migration_primary_key
to useuuid
.migration_default_prefix
is the schema name of the table in postgresql.
config :portishead, Portishead.Repo,
migration_primary_key: [name: :uuid, type: :uuid],
migration_default_prefix: "portishead",
migration_source: "portishead_schema_migrations"
Top comments (0)