Skip to content
Snippets Groups Projects

fix for drop hive_post_tags without assign tags to post during upgrades

Merged Marcin requested to merge mi_upgrade_tags_fault into develop
1 file
+ 14
0
Compare changes
  • Side-by-side
  • Inline
@@ -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;
Loading