debianize-mobilizon/priv/repo/migrations/20171207180739_create_coherence_rememberable.exs
Thomas Citharel 90ceb4f6fe initial commit
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2017-12-08 09:58:14 +01:00

20 lines
568 B
Elixir

defmodule Eventos.Repo.Migrations.CreateCoherenceRememberable do
use Ecto.Migration
def change do
create table(:rememberables) do
add :series_hash, :string
add :token_hash, :string
add :token_created_at, :utc_datetime
add :user_id, references(:users, on_delete: :delete_all)
timestamps()
end
create index(:rememberables, [:user_id])
create index(:rememberables, [:series_hash])
create index(:rememberables, [:token_hash])
create unique_index(:rememberables, [:user_id, :series_hash, :token_hash])
end
end