| 1 | DROP TABLE IF EXISTS accounts; |
| 2 | CREATE TABLE accounts ( |
| 3 | # Account identifier and type |
| 4 | uid int(6) not null auto_increment, |
| 5 | hruid varchar(255) not NULL, |
| 6 | |
| 7 | # Account type and state |
| 8 | type varchar(16) default null, |
| 9 | is_admin bool default false, |
| 10 | state enum('pending', 'active', 'disabled') not null default 'pending', |
| 11 | |
| 12 | # Access |
| 13 | password char(40) default null, |
| 14 | token varchar(32) default null, |
| 15 | weak_password varchar(256) default null, |
| 16 | registration_date datetime not null, |
| 17 | |
| 18 | # Administrative tools |
| 19 | flags set('watch') not null default '', |
| 20 | comment varchar(255) default null, |
| 21 | |
| 22 | # User settings |
| 23 | email varchar(255) default null, |
| 24 | full_name varchar(255) default null, |
| 25 | display_name varchar(255) default null, |
| 26 | sex enum('female', 'male') not null default 'male', |
| 27 | email_format enum('text', 'html') not null default 'html', |
| 28 | skin tinyint(1) unsigned default null, |
| 29 | last_version varchar(16) not null, |
| 30 | |
| 31 | primary key uid (uid), |
| 32 | unique key hruid (hruid), |
| 33 | key full_name (full_name), |
| 34 | key state (state), |
| 35 | key type (type) |
| 36 | ) ENGINE=InnoDB, CHARSET=utf8; |
| 37 | |
| 38 | DROP TABLE IF EXISTS account_types; |
| 39 | CREATE TABLE account_types ( |
| 40 | type varchar(16) not null, |
| 41 | perms set('mail', 'groups', 'forums', 'list', 'search', 'portal') default '', |
| 42 | |
| 43 | primary key type (type) |
| 44 | ) ENGINE=InnoDB, CHARSET=utf8; |
| 45 | |
| 46 | DROP TABLE IF EXISTS account_profiles; |
| 47 | CREATE TABLE account_profiles ( |
| 48 | uid int(6) not null, |
| 49 | pid int(6) not null, |
| 50 | perms set('owner') not null default '', |
| 51 | |
| 52 | primary key id (uid, pid), |
| 53 | key uid (uid), |
| 54 | key pid (pid) |
| 55 | ) ENGINE=InnoDB, CHARSET=utf8; |
| 56 | |
| 57 | # vim:set syntax=mysql: |