mirror of https://github.com/LemmyNet/lemmy.git
add migration
parent
a47398e423
commit
02666857ef
|
@ -0,0 +1,17 @@
|
|||
UPDATE
|
||||
post_aggregates
|
||||
SET
|
||||
controversy_rank = CASE WHEN downvotes <= 0
|
||||
OR upvotes <= 0 THEN
|
||||
0
|
||||
ELSE
|
||||
(upvotes + downvotes) * CASE WHEN upvotes > downvotes THEN
|
||||
downvotes::float / upvotes::float
|
||||
ELSE
|
||||
upvotes::float / downvotes::float
|
||||
END
|
||||
END
|
||||
WHERE
|
||||
upvotes > 0
|
||||
AND downvotes > 0;
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
UPDATE
|
||||
post_aggregates
|
||||
SET
|
||||
controversy_rank = CASE WHEN downvotes <= 0
|
||||
OR upvotes <= 0 THEN
|
||||
0
|
||||
ELSE
|
||||
(upvotes + downvotes) ^ CASE WHEN upvotes > downvotes THEN
|
||||
downvotes::float / upvotes::float
|
||||
ELSE
|
||||
upvotes::float / downvotes::float
|
||||
END
|
||||
END
|
||||
WHERE
|
||||
upvotes > 0
|
||||
AND downvotes > 0;
|
||||
|
Loading…
Reference in New Issue