Packages

A flexible authentication (and more) solution for Phoenix

Current section

Files

Jump to
haytni priv migrations 0-lockable_changes.ex
Raw

priv/migrations/0-lockable_changes.ex

defmodule Haytni.Migrations.LockableChanges do
use Ecto.Migration
def change do
create_if_not_exists table(<%= inspect table %>) do
# NOP
end
alter table(<%= inspect table %>) do
add :locked_at, :utc_datetime, default: nil
add :failed_attempts, :integer, default: 0, null: false
add :unlock_token, :string, default: nil
end
create index(<%= inspect table %>, ~W[unlock_token]a, unique: true)
end
end