Skip to content
Snippets Groups Projects
Commit 7f3f2c15 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

The identity table sequence reset during truncation of hive_mentions table

Included commit of latest develop the upgrade procedure has been prepared for.
parent f4e8411b
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!338Bw db upgrade support2
...@@ -53,7 +53,7 @@ END IF; ...@@ -53,7 +53,7 @@ END IF;
IF EXISTS (SELECT * FROM hive_db_data_migration WHERE migration = 'update_hive_post_mentions refill execution') THEN IF EXISTS (SELECT * FROM hive_db_data_migration WHERE migration = 'update_hive_post_mentions refill execution') THEN
RAISE NOTICE 'Performing hive_mentions refill...'; RAISE NOTICE 'Performing hive_mentions refill...';
SET work_mem='2GB'; SET work_mem='2GB';
TRUNCATE TABLE hive_mentions; TRUNCATE TABLE hive_mentions RESTART IDENTITY;
PERFORM update_hive_posts_mentions(0, (select max(num) from hive_blocks)); PERFORM update_hive_posts_mentions(0, (select max(num) from hive_blocks));
ELSE ELSE
RAISE NOTICE 'Skipping hive_mentions refill...'; RAISE NOTICE 'Skipping hive_mentions refill...';
...@@ -98,6 +98,7 @@ values ...@@ -98,6 +98,7 @@ values
,(now(), '0e3c8700659d98b45f1f7146dc46a195f905fc2d') -- https://gitlab.syncad.com/hive/hivemind/-/merge_requests/306 update posts children count fix ,(now(), '0e3c8700659d98b45f1f7146dc46a195f905fc2d') -- https://gitlab.syncad.com/hive/hivemind/-/merge_requests/306 update posts children count fix
,(now(), '9e126e9d762755f2b9a0fd68f076c9af6bb73b76') -- https://gitlab.syncad.com/hive/hivemind/-/merge_requests/314 mentions fix ,(now(), '9e126e9d762755f2b9a0fd68f076c9af6bb73b76') -- https://gitlab.syncad.com/hive/hivemind/-/merge_requests/314 mentions fix
,(now(), '033619277eccea70118a5b8dc0c73b913da0025f') -- https://gitlab.syncad.com/hive/hivemind/-/merge_requests/326 https://gitlab.syncad.com/hive/hivemind/-/merge_requests/322 posts rshares recalc ,(now(), '033619277eccea70118a5b8dc0c73b913da0025f') -- https://gitlab.syncad.com/hive/hivemind/-/merge_requests/326 https://gitlab.syncad.com/hive/hivemind/-/merge_requests/322 posts rshares recalc
,(now(), '1847c75702384c7e34c624fc91f24d2ef20df91d') -- latest version of develop containing included changes.
) ds (patch_date, patch_revision) ) ds (patch_date, patch_revision)
where not exists (select null from hive_db_patch_level hpl where hpl.patched_to_revision = ds.patch_revision); where not exists (select null from hive_db_patch_level hpl where hpl.patched_to_revision = ds.patch_revision);
......
...@@ -117,7 +117,7 @@ IF NOT EXISTS(SELECT data_type ...@@ -117,7 +117,7 @@ IF NOT EXISTS(SELECT data_type
WHERE table_name = 'hive_mentions' AND column_name = 'block_num') THEN WHERE table_name = 'hive_mentions' AND column_name = 'block_num') THEN
RAISE NOTICE 'Performing hive_mentions upgrade - adding new column block_num'; RAISE NOTICE 'Performing hive_mentions upgrade - adding new column block_num';
TRUNCATE TABLE public.hive_mentions; TRUNCATE TABLE public.hive_mentions RESTART IDENTITY;
PERFORM deps_save_and_drop_dependencies('public', 'hive_mentions', true); PERFORM deps_save_and_drop_dependencies('public', 'hive_mentions', true);
ALTER TABLE hive_mentions ALTER TABLE hive_mentions
...@@ -275,3 +275,6 @@ select 'update_hive_posts_children_count execution' ...@@ -275,3 +275,6 @@ select 'update_hive_posts_children_count execution'
where not exists (select null from hive_db_patch_level where patched_to_revision = '0e3c8700659d98b45f1f7146dc46a195f905fc2d' ) where not exists (select null from hive_db_patch_level where patched_to_revision = '0e3c8700659d98b45f1f7146dc46a195f905fc2d' )
; ;
--- 1847c75702384c7e34c624fc91f24d2ef20df91d latest version of develop included in this migration script.
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