summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-03-07 14:45:00 +0000
committerrinpatch <rinpatch@sdf.org>2020-03-07 14:45:00 +0000
commit80ca06227a47140d527e901a83408a63ce46b144 (patch)
tree94e963c13fad150f89327d728882c13a81762293 /priv
parent474ef512df5c7833f29e6201c52238b5d561a785 (diff)
parent6cf1958b02303da4a50987fea351434f9f7dd2aa (diff)
downloadpleroma-80ca06227a47140d527e901a83408a63ce46b144.tar.gz
pleroma-80ca06227a47140d527e901a83408a63ce46b144.zip
Merge branch 'fix/moderation-log-crashes' into 'release/2.0.0'
moderation log: fix improperly migrated data See merge request pleroma/pleroma!2277
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20200307103755_fix_moderation_log_subjects.exs9
1 files changed, 9 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200307103755_fix_moderation_log_subjects.exs b/priv/repo/migrations/20200307103755_fix_moderation_log_subjects.exs
new file mode 100644
index 000000000..d1c8539e1
--- /dev/null
+++ b/priv/repo/migrations/20200307103755_fix_moderation_log_subjects.exs
@@ -0,0 +1,9 @@
+defmodule Pleroma.Repo.Migrations.FixModerationLogSubjects do
+ use Ecto.Migration
+
+ def change do
+ execute(
+ "update moderation_log set data = safe_jsonb_set(data, '{subject}', safe_jsonb_set('[]'::jsonb, '{0}', data->'subject')) where jsonb_typeof(data->'subject') != 'array' and data->>'action' = ANY('{revoke,grant,activate,deactivate,delete}');"
+ )
+ end
+end