summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20200914105800_add_notification_constraints.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-09-22 17:13:46 +0200
committerlain <lain@soykaf.club>2020-09-22 17:13:46 +0200
commitc95859e45b18dec1d00f721ef3c5b4bb1406ea37 (patch)
treec22f7a200c0e0e551796bf5e9f1b09afccd64dd4 /priv/repo/migrations/20200914105800_add_notification_constraints.exs
parent9853c90abba213bdc87dccf5620cb0d9eb19c049 (diff)
parent02f12ec6253093d8bedaf84d78d0f7e533745e1b (diff)
downloadpleroma-c95859e45b18dec1d00f721ef3c5b4bb1406ea37.tar.gz
pleroma-c95859e45b18dec1d00f721ef3c5b4bb1406ea37.zip
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into issue/2115
Diffstat (limited to 'priv/repo/migrations/20200914105800_add_notification_constraints.exs')
-rw-r--r--priv/repo/migrations/20200914105800_add_notification_constraints.exs23
1 files changed, 23 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200914105800_add_notification_constraints.exs b/priv/repo/migrations/20200914105800_add_notification_constraints.exs
new file mode 100644
index 000000000..a65c35fd0
--- /dev/null
+++ b/priv/repo/migrations/20200914105800_add_notification_constraints.exs
@@ -0,0 +1,23 @@
+defmodule Pleroma.Repo.Migrations.AddNotificationConstraints do
+ use Ecto.Migration
+
+ def up do
+ drop(constraint(:notifications, "notifications_activity_id_fkey"))
+
+ alter table(:notifications) do
+ modify(:activity_id, references(:activities, type: :uuid, on_delete: :delete_all),
+ null: false
+ )
+ end
+ end
+
+ def down do
+ drop(constraint(:notifications, "notifications_activity_id_fkey"))
+
+ alter table(:notifications) do
+ modify(:activity_id, references(:activities, type: :uuid, on_delete: :delete_all),
+ null: true
+ )
+ end
+ end
+end