aboutsummaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorkaniini <ariadne@dereferenced.org>2019-10-27 05:28:03 +0000
committerkaniini <ariadne@dereferenced.org>2019-10-27 05:28:03 +0000
commit8785d7ba5dd20aea56ae0cd17ec2ee38ddbe94cd (patch)
treec38938a2804ca545aad18e4a1bf44facea547db4 /priv
parent93f6f173ce03148c637887aefaa93f99d0df6f09 (diff)
parentc1ff8472fd7fb84aa90cc59df99dffb7cccaa005 (diff)
downloadpleroma-8785d7ba5dd20aea56ae0cd17ec2ee38ddbe94cd.tar.gz
Merge branch 'refactor/db-not-null-constraints-for-bookmarks' into 'develop'
Add NOT NULL constraints for bookmarks table See merge request pleroma/pleroma!1891
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20191026190533_set_not_null_for_bookmarks.exs17
1 files changed, 17 insertions, 0 deletions
diff --git a/priv/repo/migrations/20191026190533_set_not_null_for_bookmarks.exs b/priv/repo/migrations/20191026190533_set_not_null_for_bookmarks.exs
new file mode 100644
index 000000000..5f3224003
--- /dev/null
+++ b/priv/repo/migrations/20191026190533_set_not_null_for_bookmarks.exs
@@ -0,0 +1,17 @@
+defmodule Pleroma.Repo.Migrations.SetNotNullForBookmarks do
+ use Ecto.Migration
+
+ # modify/3 function will require index recreation, so using execute/1 instead
+
+ def up do
+ execute("ALTER TABLE bookmarks
+ ALTER COLUMN user_id SET NOT NULL,
+ ALTER COLUMN activity_id SET NOT NULL")
+ end
+
+ def down do
+ execute("ALTER TABLE bookmarks
+ ALTER COLUMN user_id DROP NOT NULL,
+ ALTER COLUMN activity_id DROP NOT NULL")
+ end
+end