Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
082b7146
Commit
082b7146
authored
4 years ago
by
Bartek Wrona
Browse files
Options
Downloads
Plain Diff
Merge branch 'bw_sync_fixes' into 'develop'
hive sync fixes See merge request
!342
parents
0c0daad7
0ae18d45
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!456
Release candidate v1 24
,
!342
hive sync fixes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/db/sql_scripts/update_hive_posts_children_count.sql
+8
-7
8 additions, 7 deletions
hive/db/sql_scripts/update_hive_posts_children_count.sql
hive/indexer/follow.py
+12
-12
12 additions, 12 deletions
hive/indexer/follow.py
with
20 additions
and
19 deletions
hive/db/sql_scripts/update_hive_posts_children_count.sql
+
8
−
7
View file @
082b7146
...
...
@@ -67,17 +67,18 @@ CREATE OR REPLACE FUNCTION public.update_all_hive_posts_children_count()
LANGUAGE
'plpgsql'
VOLATILE
AS
$
BODY
$
declare
__depth
int
;
declare
__depth
INT
;
BEGIN
SELECT
MAX
(
hp
.
depth
)
into
__depth
FROM
hive_posts
hp
;
DROP
TABLE
if
exists
__post_children
;
create
unlogged
table
__post_children
CREATE
UNLOGGED
TABLE
IF
NOT
EXISTS
__post_children
(
id
int
not
null
,
child_count
int
not
null
,
CONSTRAINT
__post_children
2
_pkey
PRIMARY
KEY
(
id
)
id
INT
NOT
NULL
,
child_count
INT
NOT
NULL
,
CONSTRAINT
__post_children_pkey
PRIMARY
KEY
(
id
)
);
TRUNCATE
TABLE
__post_children
;
WHILE
__depth
>=
0
LOOP
INSERT
INTO
__post_children
...
...
@@ -92,7 +93,7 @@ BEGIN
WHERE
(
h1
.
parent_id
!=
0
OR
__depth
=
0
)
AND
h1
.
counter_deleted
=
0
AND
h1
.
id
!=
0
AND
h1
.
depth
=
__depth
GROUP
BY
h1
.
parent_id
ON
CONFLICT
ON
CONSTRAINT
__post_children
2
_pkey
DO
UPDATE
ON
CONFLICT
ON
CONSTRAINT
__post_children_pkey
DO
UPDATE
SET
child_count
=
__post_children
.
child_count
+
excluded
.
child_count
;
...
...
This diff is collapsed.
Click to expand it.
hive/indexer/follow.py
+
12
−
12
View file @
082b7146
...
...
@@ -277,7 +277,7 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
blacklisted = false
blacklisted = false
FROM
(
SELECT
...
...
@@ -298,7 +298,7 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
state = 0
state = 0
FROM
(
SELECT
...
...
@@ -320,7 +320,7 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
state = 0
state = 0
FROM
(
SELECT
...
...
@@ -342,7 +342,7 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
follow_blacklists = false
follow_blacklists = false
FROM
(
SELECT
...
...
@@ -383,7 +383,7 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
follow_muted = false
follow_muted = false
FROM
(
SELECT
...
...
@@ -401,7 +401,7 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
follow_muted = true
follow_muted = true
FROM
(
SELECT
...
...
@@ -423,10 +423,10 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
blacklisted = false,
hf.
follow_blacklists = false,
hf.
follow_muted = false,
hf.
state = 0
blacklisted = false,
follow_blacklists = false,
follow_muted = false,
state = 0
FROM
(
SELECT
...
...
@@ -444,8 +444,8 @@ class Follow(DbAdapterHolder):
UPDATE
hive_follows hf
SET
hf.
follow_blacklists = true,
hf.
follow_muted = true
follow_blacklists = true,
follow_muted = true
FROM
(
SELECT
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment