Flake: migrate pinned_activities in jsonb
authorhref <href@random.sh>
Wed, 23 Jan 2019 10:22:31 +0000 (11:22 +0100)
committerhref <href@random.sh>
Wed, 23 Jan 2019 10:26:39 +0000 (11:26 +0100)
priv/repo/migrations/20181218172826_users_and_activities_flake_id.exs

index 69a27e0c8776566809d96ed85cb4b2090c279099..70ec58cd23980b593eeae8c5c16453d114c22c53 100644 (file)
@@ -37,6 +37,8 @@ defmodule Pleroma.Repo.Migrations.UsersAndActivitiesFlakeId do
     execute "ALTER TABLE activities ADD PRIMARY KEY (id);"
     execute "ALTER TABLE users ADD PRIMARY KEY (id);"
 
+    execute "UPDATE users SET info = jsonb_set(info, '{pinned_activities}', array_to_json(ARRAY(select jsonb_array_elements_text(info->'pinned_activities')))::jsonb);"
+
     # Fkeys:
     # Activities - Referenced by:
     #   TABLE "notifications" CONSTRAINT "notifications_activity_id_fkey" FOREIGN KEY (activity_id) REFERENCES activities(id) ON DELETE CASCADE