Skip to content
Snippets Groups Projects
Commit d29a80d1 authored by Bartek Wrona's avatar Bartek Wrona Committed by Dan Notestein
Browse files

Upgrade code should be executed conditionally to avoid errors when upgrade is...

Upgrade code should be executed conditionally to avoid errors when upgrade is not applicable to given version and should be skipped.
parent bef1ae85
No related branches found
No related tags found
2 merge requests!827Merge develop changes to master,!686One of hive_follows indexes extended by `id` column to eliminate HEAP sort...
......@@ -2,6 +2,13 @@ SET ROLE hivemind;
--- Put runtime data migration code here
DO
$$
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_name='hivemind_app.hive_posts' and column_name='tags_ids') THEN
RAISE NOTICE 'Performing TAG-IDs migration';
WITH data_source AS
(
SELECT p.id AS post_id, unnest(p.tags_ids) AS tag_id
......@@ -24,6 +31,12 @@ TABLESPACE haf_tablespace
ALTER TABLE hivemind_app.hive_post_tags INHERIT hive.hivemind_app;
ANALYZE VERBOSE hivemind_app.hive_post_tags;
ELSE
RAISE NOTICE 'TAG-IDs migration skipped';
END IF;
END
$$
;
--- Must be at the end
TRUNCATE TABLE hivemind_app.hive_db_data_migration;
......
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