Add models and migrations
This commit is contained in:
parent
182523d36d
commit
9e542bc790
33 changed files with 597 additions and 125 deletions
18
priv/repo/migrations/20250606103230_create_notifications.exs
Normal file
18
priv/repo/migrations/20250606103230_create_notifications.exs
Normal file
|
@ -0,0 +1,18 @@
|
|||
defmodule Nulla.Repo.Migrations.CreateNotifications do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:notifications) do
|
||||
add :user_id, references(:users, on_delete: :delete_all), null: false
|
||||
add :actor_id, references(:users, on_delete: :nilify_all)
|
||||
add :type, :string, null: false
|
||||
add :data, :map
|
||||
add :read, :boolean, default: false, null: false
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:notifications, [:user_id])
|
||||
create index(:notifications, [:actor_id])
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue