Flake: migrate pinned_activities in jsonb

This commit is contained in:
href 2019-01-23 11:22:31 +01:00
parent a92c43bc4b
commit e67bd93d90
No known key found for this signature in database
GPG key ID: EE8296C1A152C325

View file

@ -37,6 +37,8 @@ def change do
execute "ALTER TABLE activities ADD PRIMARY KEY (id);" execute "ALTER TABLE activities ADD PRIMARY KEY (id);"
execute "ALTER TABLE users 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: # Fkeys:
# Activities - Referenced by: # Activities - Referenced by:
# TABLE "notifications" CONSTRAINT "notifications_activity_id_fkey" FOREIGN KEY (activity_id) REFERENCES activities(id) ON DELETE CASCADE # TABLE "notifications" CONSTRAINT "notifications_activity_id_fkey" FOREIGN KEY (activity_id) REFERENCES activities(id) ON DELETE CASCADE