defmodule Vigil.Repo.Migrations.CreateNeiamAuthAppCodes do
use Ecto.Migration
# neiam_auth: one-time codes that hand an SSO sign-in from the system
# browser back to the native app (NeiamAuth.AppCode). Only the SHA-256
# of a code is stored; each lives two minutes and is deleted when used.
def change do
create table(:neiam_auth_app_codes, primary_key: false) do
add :code_hash, :binary, primary_key: true
add :user_id, references(:users, type: :binary_id, on_delete: :delete_all), null: false
add :challenge, :text, null: false
add :device_name, :text
add :expires_at, :utc_datetime_usec, null: false
timestamps(type: :utc_datetime_usec, updated_at: false)
end
create index(:neiam_auth_app_codes, [:expires_at])
end
end
neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions running · Badges · Packages
⭐
Log in to mark this repository.
787 B · text
History
bbb2a48