Update migrations
This commit is contained in:
parent
50abfe4748
commit
57efda7638
12 changed files with 56 additions and 35 deletions
18
priv/repo/migrations/20250615131610_create_sessions.exs
Normal file
18
priv/repo/migrations/20250615131610_create_sessions.exs
Normal file
|
@ -0,0 +1,18 @@
|
|||
defmodule Nulla.Repo.Migrations.CreateSessions do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:sessions, primary_key: false) do
|
||||
add :id, :bigint, primary_key: true
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue