logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 904598b89c78296f31e7e7703cd6f23e1e916d66
parent: 5d4b0e83c677698bbfacfa3fbabe31a656138919
Author: kaniini <ariadne@dereferenced.org>
Date:   Sun, 27 Oct 2019 05:26:31 +0000

Merge branch 'refactor/db-not-null-constraints-for-activities' into 'develop'

Add NOT NULL constraints for activities table

See merge request pleroma/pleroma!1888

Diffstat:

Apriv/repo/migrations/20191026190317_set_not_null_for_activities.exs17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/priv/repo/migrations/20191026190317_set_not_null_for_activities.exs b/priv/repo/migrations/20191026190317_set_not_null_for_activities.exs @@ -0,0 +1,17 @@ +defmodule Pleroma.Repo.Migrations.SetNotNullForActivities do + use Ecto.Migration + + # modify/3 function will require index recreation, so using execute/1 instead + + def up do + execute("ALTER TABLE activities + ALTER COLUMN data SET NOT NULL, + ALTER COLUMN local SET NOT NULL") + end + + def down do + execute("ALTER TABLE activities + ALTER COLUMN data DROP NOT NULL, + ALTER COLUMN local DROP NOT NULL") + end +end