-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.sql
33 lines (31 loc) · 1.1 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
/* Authentication should always be possible via password (assuming user
* has created a local password). Other options for the future include
* OAuth2.0 or OpenID
*/
CREATE TABLE accounts (
account_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
email CHAR(128) NOT NULL,
PRIMARY KEY (account_id),
UNIQUE KEY email (email)
);
/* Not sure how to handle this - we should have some kind of username
* for all methods probably, except that makes things more complicated
* for anything other than user/pass auth.
*
* auth_type should be something like 'local', 'google', 'openid', 'facebook'
*/
CREATE TABLE account_auths (
account_auth_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
account_id INT(10) UNSIGNED NOT NULL,
auth_type CHAR(10) NOT NULL,
PRIMARY KEY (account_auth_id),
KEY account_id (account_id)
);
/* Local authentication requires a password */
CREATE TABLE account_auths_local (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
account_auth_id INT(10) UNSIGNED NOT NULL,
password CHAR(40),
PRIMARY KEY (id),
UNIQUE KEY account_auth_id(account_auth_id)
);