User Roles

View Source

Ecto Repo

defmodule MyApp.Repo do
  use Ecto.Repo, adapter: Ecto.Adapters.Postgres, otp_app: :my_app
end

Enum definition

defmodule MyApp.DynamicEnums do
  use Enumex.Dynamic,
    components: [
      Enumex.Dynamic.Components.Context,
      Enumex.Dynamic.Components.Convert,
      Enumex.Dynamic.Components.EctoChangeset,
      Enumex.Dynamic.Components.EctoSchema,
      Enumex.Dynamic.Components.Typespecs
    ],
    repo: MyApp.Repo

  enum UserRole, :user_roles, id: :role_name, index: :role_number do
    field :external_role_id, :string
  end
end