Skip to content

Commit 259b3c6

Browse files
committed
Latest schema with change to scoring
1 parent 4916859 commit 259b3c6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

data/db/schema.sql

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,25 +491,25 @@ SELECT
491491
CASE WHEN direction = 'UP' THEN
492492
1
493493
WHEN direction = 'DOWN' THEN
494-
- 1
494+
-1
495495
ELSE
496496
0
497497
END), 0) "voteDelta",
498-
sum(
498+
round(coalesce((sum(
499499
CASE WHEN direction = 'UP' THEN
500500
1
501501
WHEN direction = 'DOWN' THEN
502-
- 1
502+
-1
503503
ELSE
504504
0
505-
END) - 1 / (DATE_PART('hour', now() - max("Vote"."createdAt")) + 2) ^ 1.8 AS "score",
506-
rank() OVER (ORDER BY coalesce(sum( CASE WHEN direction = 'UP' THEN
505+
END ) - 1) / (DATE_PART('hour', now() - max("Vote"."createdAt")) + 2) ^ 1.8 * 100000, -2147483648)::numeric, 0) AS "score",
506+
rank() OVER (ORDER BY round(coalesce((sum( CASE WHEN direction = 'UP' THEN
507507
1
508508
WHEN direction = 'DOWN' THEN
509-
- 1
509+
-1
510510
ELSE
511511
0
512-
END) - 1 / (DATE_PART('hour', now() - max("Vote"."createdAt")) + 2) ^ 1.8, '-infinity')
512+
END) - 1) / (DATE_PART('hour', now() - max("Vote"."createdAt")) + 2) ^ 1.8 * 100000, -2147483648)::numeric, 0)
513513
DESC,
514514
"Post"."createdAt" DESC,
515515
"Post".title ASC) "voteRank"
@@ -1331,6 +1331,8 @@ CREATE TABLE auth.users (
13311331
email_change_token_current character varying(255) DEFAULT ''::character varying,
13321332
email_change_confirm_status smallint DEFAULT 0,
13331333
banned_until timestamp with time zone,
1334+
reauthentication_token character varying(255) DEFAULT ''::character varying,
1335+
reauthentication_sent_at timestamp with time zone,
13341336
CONSTRAINT users_email_change_confirm_status_check CHECK (((email_change_confirm_status >= 0) AND (email_change_confirm_status <= 2)))
13351337
);
13361338

@@ -1427,7 +1429,7 @@ CREATE TABLE public."Post" (
14271429
"downVoteTotal" integer DEFAULT 0 NOT NULL,
14281430
"voteTotal" integer DEFAULT 0 NOT NULL,
14291431
"voteRank" integer DEFAULT 1 NOT NULL,
1430-
score real DEFAULT '0'::real,
1432+
score integer DEFAULT 0,
14311433
"voteDelta" integer DEFAULT 0 NOT NULL,
14321434
CONSTRAINT post_title_length CHECK ((char_length(title) > 0)),
14331435
CONSTRAINT post_url_length CHECK ((char_length(url) > 0))

0 commit comments

Comments
 (0)