This repository was archived by the owner on Nov 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmy.sql
176 lines (161 loc) · 6.92 KB
/
my.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# DROP DATABASE doublespark;
# CREATE DATABASE doublespark default character SET utf8;
# USE doublespark;
BEGIN;
CREATE TABLE account (
account_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, data MEDIUMBLOB NOT NULL
, is_owner TINYINT
, modified_on BIGINT UNSIGNED NOT NULL
, authenticated_on DATETIME NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
) ENGINE=InnoDB charset=utf8;
CREATE TABLE tw_account (
tw_account_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, code VARCHAR(256) CHARACTER SET ASCII NOT NULL UNIQUE COMMENT 'tw-user_id'
, name VARCHAR(20) CHARACTER SET ASCII NOT NULL UNIQUE
, data MEDIUMBLOB NOT NULL
, authenticated_on DATETIME NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE fb_account (
fb_account_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, code VARCHAR(256) CHARACTER SET ASCII NOT NULL UNIQUE COMMENT 'fb-id'
, name VARCHAR(256) NOT NULL
, data MEDIUMBLOB NOT NULL
, authenticated_on DATETIME NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE email_account (
email_account_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, code VARCHAR(256) CHARACTER SET ASCII NOT NULL UNIQUE COMMENT 'email address'
, name VARCHAR(20)
, password_saltedhash VARCHAR(256)
, authenticated_on DATETIME NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE google_account (
google_account_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, code VARCHAR(256) CHARACTER SET ASCII NOT NULL UNIQUE COMMENT 'email address'
, name VARCHAR(64)
, data MEDIUMBLOB NOT NULL
, authenticated_on DATETIME NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE list (
list_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, data MEDIUMBLOB NOT NULL
, public_code VARCHAR(16) CHARACTER SET ASCII
, invite_code VARCHAR(16) CHARACTER SET ASCII
, actioned_on BIGINT UNSIGNED NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE list_account (
list_account_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, list_id BIGINT UNSIGNED NOT NULL
, account_id BIGINT UNSIGNED NOT NULL
, created_on DATETIME NOT NULL
, FOREIGN KEY (list_id) REFERENCES list(list_id) ON DELETE CASCADE
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE request (
request_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, name VARCHAR(256) CHARACTER SET ASCII NOT NULL COMMENT 'screen_name'
, lang VARCHAR(2) CHARACTER SET ASCII NOT NULL
, request TEXT NOT NULL
, response TEXT NOT NULL
, is_public TINYINT
, label_class ENUM('success', 'warning', 'important', 'notice')
, label_name VARCHAR(16) CHARACTER SET ASCII NOT NULL
, data MEDIUMBLOB NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
) ENGINE=InnoDB charset=utf8;
CREATE TABLE question (
question_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, lang VARCHAR(2) CHARACTER SET ASCII NOT NULL
, question TEXT NOT NULL
, answer TEXT NOT NULL
, is_public TINYINT
, data MEDIUMBLOB NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
) ENGINE=InnoDB charset=utf8;
CREATE TABLE app (
app_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, account_id BIGINT UNSIGNED NOT NULL
, name VARCHAR(32) NOT NULL UNIQUE
, description VARCHAR(256) NOT NULL
, website VARCHAR(256) CHARACTER SET ASCII NOT NULL
, organization VARCHAR(256) NOT NULL
, organization_website VARCHAR(256) CHARACTER SET ASCII NOT NULL
, callback_url VARCHAR(256) NOT NULL
, consumer_key VARCHAR(16) CHARACTER SET ASCII NOT NULL
, consumer_secret VARCHAR(32) CHARACTER SET ASCII NOT NULL
, access_level ENUM('r', 'rw')
, data MEDIUMBLOB NOT NULL
, tokens INT DEFAULT 0
, is_disabled TINYINT DEFAULT 0
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE request_token (
request_token_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, app_id BIGINT UNSIGNED NOT NULL
, account_id BIGINT UNSIGNED
, token VARCHAR(32) CHARACTER SET ASCII NOT NULL
, secret VARCHAR(32) CHARACTER SET ASCII NOT NULL
, realm VARCHAR(32) CHARACTER SET ASCII NOT NULL
, consumer_key VARCHAR(16) CHARACTER SET ASCII NOT NULL
, expired_on INT DEFAULT 0
, callback_url VARCHAR(256)
, verifier VARCHAR(8) CHARACTER SET ASCII
, is_exchanged_to_access_token TINYINT DEFAULT 0
, is_authorized_by_user TINYINT DEFAULT 0
, is_expired TINYINT DEFAULT 0
, authenticated_on DATETIME NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (app_id) REFERENCES app(app_id) ON DELETE CASCADE
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE access_token (
access_token_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, app_id BIGINT UNSIGNED NOT NULL
, account_id BIGINT UNSIGNED NOT NULL
, access_token VARCHAR(64) CHARACTER SET ASCII NOT NULL
, access_token_secret VARCHAR(64) CHARACTER SET ASCII NOT NULL
, access_level ENUM('r', 'rw')
, is_disabled TINYINT DEFAULT 0
, authenticated_on DATETIME NOT NULL
, created_on DATETIME NOT NULL
, updated_on DATETIME NOT NULL
, FOREIGN KEY (app_id) REFERENCES app(app_id) ON DELETE CASCADE
, FOREIGN KEY (account_id) REFERENCES account(account_id) ON DELETE CASCADE
) ENGINE=InnoDB charset=utf8;
CREATE TABLE request_log (
request_log_id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
, consumer_key VARCHAR(64) CHARACTER SET ASCII NOT NULL
, nonce VARCHAR(64) CHARACTER SET ASCII NOT NULL
, timestamp INT NOT NULL
) ENGINE=InnoDB charset=utf8;
COMMIT;