-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathschema.sql
132 lines (119 loc) · 2.82 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
CREATE TABLE accounts (
created_at TIMESTAMP,
updated_at TIMESTAMP,
name VARCHAR(60) UNIQUE,
metadata JSONB,
owner JSONB,
active JSONB,
posting JSONB,
memo_key VARCHAR(255),
balance DECIMAL(50,3) DEFAULT 0,
sbd_balance DECIMAL(50,3) DEFAULT 0,
vesting_shares DECIMAL(50,6) DEFAULT 0,
delegated_vesting_shares DECIMAL(50,6) DEFAULT 0,
received_vesting_shares DECIMAL(50,6) DEFAULT 0
);
CREATE TABLE posts (
created_at TIMESTAMP,
updated_at TIMESTAMP,
category VARCHAR(255),
author VARCHAR(16),
permlink VARCHAR(255),
title VARCHAR(255),
body TEXT,
metadata JSONB,
CONSTRAINT uc_post UNIQUE (author, permlink)
);
CREATE TABLE comments (
created_at TIMESTAMP,
updated_at TIMESTAMP,
parent_author VARCHAR(32),
parent_permlink VARCHAR(255),
author VARCHAR(32),
permlink VARCHAR(255),
body TEXT,
CONSTRAINT uc_comment UNIQUE (author, permlink)
);
CREATE TABLE votes (
created_at TIMESTAMP,
updated_at TIMESTAMP,
post_author VARCHAR(16),
post_permlink VARCHAR(255),
voter VARCHAR(16) NOT NULL,
weight SMALLINT DEFAULT 0,
rshares BIGINT DEFAULT 0,
CONSTRAINT uc_vote UNIQUE (post_author, post_permlink, voter)
);
CREATE TABLE follows (
created_at TIMESTAMP,
updated_at TIMESTAMP,
follower VARCHAR(16),
followed VARCHAR(16),
what JSONB,
CONSTRAINT uc_follow UNIQUE (follower, followed)
);
CREATE TABLE communities (
account_id DECIMAL NOT NULL,
type SMALLINT,
name VARCHAR(16),
about VARCHAR(512),
description VARCHAR(5000),
language VARCHAR(10),
is_nsfw BOOLEAN
);
CREATE TABLE members (
community_id DECIMAL NOT NULL,
account_id DECIMAL NOT NULL,
is_admin BOOLEAN,
is_mod BOOLEAN,
is_approved BOOLEAN,
is_muted BOOLEAN,
title VARCHAR(100)
);
CREATE TABLE flags (
account_id DECIMAL NOT NULL,
community_id DECIMAL NOT NULL,
post_id DECIMAL NOT NULL,
notes VARCHAR(240)
);
CREATE TABLE modlogs (
account_id DECIMAL NOT NULL,
community_id DECIMAL NOT NULL,
action SMALLINT,
params VARCHAR(100)
);
CREATE TABLE producer_rewards (
created_at TIMESTAMP,
producer VARCHAR(16),
vesting_shares DECIMAL(50,6)
);
CREATE TABLE author_rewards (
created_at TIMESTAMP,
author VARCHAR(16),
permlink VARCHAR(255),
sbd_payout DECIMAL(50,3),
steem_payout DECIMAL(50,3),
vesting_payout DECIMAL(50,6)
);
CREATE TABLE curation_rewards (
created_at TIMESTAMP,
curator VARCHAR(16),
reward DECIMAL(50,6),
comment_author VARCHAR(16),
comment_permlink VARCHAR(255),
CONSTRAINT uc_curation_reward UNIQUE (curator, comment_author, comment_permlink)
);
CREATE TABLE reblogs (
created_at TIMESTAMP,
account VARCHAR(16) NOT NULL,
author VARCHAR(16),
permlink VARCHAR(255)
);
CREATE TABLE transfers (
created_at TIMESTAMP,
transfer_from VARCHAR(16),
transfer_to VARCHAR(16),
amount DECIMAL(50,3),
asset VARCHAR(255),
memo TEXT
);