615b56081725640cd42ba1857a4e705f8ea91e06
[anni] / priv / repo / migrations / 20170911123607_create_notifications.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Repo.Migrations.CreateNotifications do
6   use Ecto.Migration
7
8   def change do
9     create_if_not_exists table(:notifications) do
10       add(:user_id, references(:users, on_delete: :delete_all))
11       add(:activity_id, references(:activities, on_delete: :delete_all))
12       add(:seen, :boolean, default: false)
13
14       timestamps()
15     end
16
17     create_if_not_exists(index(:notifications, [:user_id]))
18   end
19 end