If for some reason you need to create a UUID field for your schema (a non-primary key field), and you don't want to manage the creation of the value to store on the new database record, you can specify in the migration to use as default value the uuid_generate_v4() Postgresql method, so it will be auto-generated on the insert: defmodule App.Repo.Migrations.AddUuidFieldToUser do use Ecto.Migration
