Skip to content
Snippets Groups Projects
Commit cb1563e2 authored by Marcin's avatar Marcin
Browse files

fix for drop hive_post_dags without assign tags to post during upgrades

parent d90efed9
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!405fix for drop hive_post_tags without assign tags to post during upgrades
......@@ -225,6 +225,20 @@ IF NOT EXISTS(SELECT data_type FROM information_schema.columns
WHERE table_name = 'hive_posts' AND column_name = 'tags_ids') THEN
ALTER TABLE ONLY hive_posts
ADD COLUMN tags_ids INTEGER[];
UPDATE hive_posts hp
SET
tags_ids = tags.tags
FROM
(
SELECT
post_id as post_id,
array_agg( hpt.tag_id ) as tags
FROM
hive_post_tags hpt
GROUP BY post_id
) as tags
WHERE hp.id = tags.post_id;
ELSE
RAISE NOTICE 'SKIPPING hive_posts upgrade - adding a tags_ids column';
END IF;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment