From 6522cc0b1521091ddab6d3dc7bb3af4aea617629 Mon Sep 17 00:00:00 2001 From: SimonLab Date: Mon, 18 May 2020 15:06:58 +0100 Subject: [PATCH] create user_agents and login_logs tables, #67 --- .../migrations/20200518135714_login_log.exs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 priv/repo/migrations/20200518135714_login_log.exs diff --git a/priv/repo/migrations/20200518135714_login_log.exs b/priv/repo/migrations/20200518135714_login_log.exs new file mode 100644 index 00000000..18faf605 --- /dev/null +++ b/priv/repo/migrations/20200518135714_login_log.exs @@ -0,0 +1,21 @@ +defmodule Auth.Repo.Migrations.LoginLog do + use Ecto.Migration + + def change do + create table(:user_agents) do + add :user_agent, :binary + end + + create table(:login_logs) do + add :email, :binary + add :ip_address, :binary + add :person_id, references(:people, on_delete: :nothing) + add :user_agent_id, references(:user_agents, on_delete: :nothing) + + timestamps() + end + + create index(:login_logs, [:person_id]) + create index(:login_logs, [:user_agent_id]) + end +end