defmodule Vigil.Repo.Migrations.CreateUserInvites do
use Ecto.Migration
# Registration invites (Vigil.Accounts.Invite), as the sibling apps:
# while registration is closed, the way to an account. Only a SHA-256 of
# each link's token is kept.
def change do
create table(:user_invites, primary_key: false) do
add :id, :binary_id, primary_key: true
add :token_hash, :binary, null: false
add :note, :string
add :email, :string
add :created_by_id, references(:users, type: :binary_id, on_delete: :nilify_all)
add :consumed_by_id, references(:users, type: :binary_id, on_delete: :nilify_all)
add :expires_at, :utc_datetime
add :consumed_at, :utc_datetime
timestamps(type: :utc_datetime)
end
create unique_index(:user_invites, [:token_hash])
create index(:user_invites, [:created_by_id])
create index(:user_invites, [:email])
end
end
neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions running · Badges · Packages
⭐
Log in to mark this repository.
917 B · text
History
5901e75