replace coherence with guardian
This commit is contained in:
@@ -3,14 +3,14 @@ defmodule Eventos.Repo.Migrations.CreateUsers do
|
||||
|
||||
def change do
|
||||
create table(:users) do
|
||||
add :username, :string
|
||||
add :email, :string
|
||||
add :role, :integer, default: 0
|
||||
add :email, :string, null: false
|
||||
add :role, :integer, default: 0, null: false
|
||||
add :password_hash, :string
|
||||
add :account_id, references(:accounts, on_delete: :delete_all, null: false)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create unique_index(:users, [:username])
|
||||
create unique_index(:users, [:email])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
defmodule Eventos.Repo.Migrations.AddCoherenceToUser do
|
||||
use Ecto.Migration
|
||||
def change do
|
||||
alter table(:users) do
|
||||
# confirmable
|
||||
add :confirmation_token, :string
|
||||
add :confirmed_at, :utc_datetime
|
||||
add :confirmation_sent_at, :utc_datetime
|
||||
# rememberable
|
||||
add :remember_created_at, :utc_datetime
|
||||
# authenticatable
|
||||
add :password_hash, :string
|
||||
add :active, :boolean, null: false, default: true
|
||||
# recoverable
|
||||
add :reset_password_token, :string
|
||||
add :reset_password_sent_at, :utc_datetime
|
||||
# lockable
|
||||
add :failed_attempts, :integer, default: 0
|
||||
add :locked_at, :utc_datetime
|
||||
# trackable
|
||||
add :sign_in_count, :integer, default: 0
|
||||
add :current_sign_in_at, :utc_datetime
|
||||
add :last_sign_in_at, :utc_datetime
|
||||
add :current_sign_in_ip, :string
|
||||
add :last_sign_in_ip, :string
|
||||
# unlockable_with_token
|
||||
add :unlock_token, :string
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
defmodule Eventos.Repo.Migrations.CreateCoherenceInvitable do
|
||||
use Ecto.Migration
|
||||
def change do
|
||||
create table(:invitations) do
|
||||
|
||||
add :name, :string
|
||||
add :email, :string
|
||||
add :token, :string
|
||||
timestamps()
|
||||
end
|
||||
create unique_index(:invitations, [:email])
|
||||
create index(:invitations, [:token])
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
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
|
||||
@@ -12,6 +12,6 @@
|
||||
|
||||
Eventos.Repo.delete_all Eventos.Accounts.User
|
||||
|
||||
Eventos.Accounts.User.changeset(%Eventos.Accounts.User{}, %{username: "Test User", email: "testuser@example.com", password: "secret", password_confirmation: "secret"})
|
||||
Eventos.Accounts.User.registration_changeset(%Eventos.Accounts.User{}, %{email: "testuser@example.com", password: "secret", password_confirmation: "secret"})
|
||||
|> Eventos.Repo.insert!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user