total rebase
[anni] / priv / repo / migrations / 20200914105800_add_notification_constraints.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.AddNotificationConstraints do
6   use Ecto.Migration
7
8   def up do
9     drop(constraint(:notifications, "notifications_activity_id_fkey"))
10
11     alter table(:notifications) do
12       modify(:activity_id, references(:activities, type: :uuid, on_delete: :delete_all),
13         null: false
14       )
15     end
16   end
17
18   def down do
19     drop(constraint(:notifications, "notifications_activity_id_fkey"))
20
21     alter table(:notifications) do
22       modify(:activity_id, references(:activities, type: :uuid, on_delete: :delete_all),
23         null: true
24       )
25     end
26   end
27 end