Skip to main content

priv/templates/ez_auth.install/00000000000002_ez_auth_create_users.exs.eex

# This file was generated by `mix ez_auth.install`.
# Regenerate it by rerunning the installer after updating EzAuth.

defmodule <%= inspect repo %>.Migrations.EzAuthCreateUsers do
  use Ecto.Migration

  def change do
    create table(:users, prefix: "auth") do
      add :name, :string
      add :username, :citext
      add :hashed_password, :string
      add :metadata, :map, null: false, default: %{}
      add :anonymous, :boolean, null: false, default: false

      timestamps(type: :utc_datetime)
    end

    create unique_index(:users, [:username], prefix: "auth")
  end
end