Add models and migrations

This commit is contained in:
Mirai Kumiko 2025-06-06 16:07:04 +02:00
parent 182523d36d
commit 9e542bc790
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
33 changed files with 597 additions and 125 deletions

View file

@ -0,0 +1,17 @@
defmodule Nulla.Repo.Migrations.CreateSessions do
use Ecto.Migration
def change do
create table(:sessions) do
add :user_id, references(:users, on_delete: :delete_all), null: false
add :token, :string, null: false
add :user_agent, :string
add :ip, :string
timestamps(type: :utc_datetime)
end
create index(:sessions, [:user_id])
create unique_index(:sessions, [:token])
end
end