1 DROP TABLE IF EXISTS `users`;
3 `id` int(11) NOT NULL AUTO_INCREMENT,
4 `email` varchar(255) NOT NULL DEFAULT '',
5 `password` varchar(255) NOT NULL DEFAULT '',
6 `fname` varchar(255) NOT NULL DEFAULT '',
7 `mname` varchar(255) NOT NULL DEFAULT '',
8 `lname` varchar(255) NOT NULL DEFAULT '',
9 `suffix` varchar(50) NOT NULL DEFAULT '',
10 `dob` date NOT NULL DEFAULT '0000-00-00',
11 `verified` int(1) NOT NULL DEFAULT '0',
12 `ccid` int(3) NOT NULL DEFAULT '0',
13 `regid` int(5) NOT NULL DEFAULT '0',
14 `locid` int(7) NOT NULL DEFAULT '0',
15 `listme` int(1) NOT NULL DEFAULT '0',
16 `contactinfo` varchar(255) NOT NULL DEFAULT '',
17 `admin` tinyint(1) NOT NULL DEFAULT '0',
18 `language` varchar(5) NOT NULL DEFAULT '',
19 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
20 `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
21 `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
22 `locked` tinyint(1) NOT NULL DEFAULT '0',
23 `assurer_blocked` tinyint(1) NOT NULL DEFAULT '0',
26 KEY `regid` (`regid`),
27 KEY `locid` (`locid`),
28 KEY `email` (`email`),
29 KEY `stats_users_created` (`created`),
30 KEY `stats_users_verified` (`verified`),
31 KEY `userverified` (`verified`)
32 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
35 DROP TABLE IF EXISTS `domains`;
36 CREATE TABLE `domains` (
37 `id` int(11) NOT NULL AUTO_INCREMENT,
38 `memid` int(11) NOT NULL,
39 `domain` varchar(255) NOT NULL,
40 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
41 `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
42 `deleted` datetime DEFAULT NULL,
44 KEY `memid` (`memid`),
45 KEY `domain` (`domain`),
46 KEY `stats_domains_deleted` (`deleted`)
47 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
49 DROP TABLE IF EXISTS `emails`;
50 CREATE TABLE `emails` (
51 `id` int(11) NOT NULL AUTO_INCREMENT,
52 `memid` int(11) NOT NULL DEFAULT '0',
53 `email` varchar(255) NOT NULL DEFAULT '',
54 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
55 `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
56 `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
57 `hash` varchar(50) NOT NULL DEFAULT '',
58 `attempts` int(1) NOT NULL DEFAULT '0',
60 KEY `memid` (`memid`),
61 KEY `stats_email_hash` (`hash`),
62 KEY `stats_email_deleted` (`deleted`),
64 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
66 DROP TABLE IF EXISTS `emailPinglog`;
67 CREATE TABLE `emailPinglog` (
68 `when` datetime NOT NULL,
69 `uid` int(11) NOT NULL,
70 `emailid` int(11) NOT NULL,
71 `type` enum('fast', 'active') NOT NULL,
72 `status` enum('open', 'success', 'failed') NOT NULL,
73 `result` varchar(255) NOT NULL
74 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
76 DROP TABLE IF EXISTS `pingconfig`;
77 CREATE TABLE `pingconfig` (
78 `id` int(13) NOT NULL AUTO_INCREMENT,
79 `domainid` int(11) NOT NULL,
80 `type` enum('email', 'ssl', 'http', 'dns') NOT NULL,
81 `info` varchar(255) NOT NULL,
82 `reping` enum('y','n') NOT NULL DEFAULT 'n',
84 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
87 DROP TABLE IF EXISTS `domainPinglog`;
88 CREATE TABLE `domainPinglog` (
89 `when` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
90 `configId` int(13) NOT NULL,
91 `state` enum('open', 'success', 'failed') NOT NULL,
92 `challenge` varchar(16),
94 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
96 DROP TABLE IF EXISTS `baddomains`;
97 CREATE TABLE `baddomains` (
98 `domain` varchar(255) NOT NULL DEFAULT ''
99 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
102 DROP TABLE IF EXISTS `alerts`;
103 CREATE TABLE `alerts` (
104 `memid` int(11) NOT NULL DEFAULT '0',
105 `general` tinyint(1) NOT NULL DEFAULT '0',
106 `country` tinyint(1) NOT NULL DEFAULT '0',
107 `regional` tinyint(1) NOT NULL DEFAULT '0',
108 `radius` tinyint(1) NOT NULL DEFAULT '0',
109 PRIMARY KEY (`memid`)
110 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
112 DROP TABLE IF EXISTS `user_agreements`;
113 CREATE TABLE `user_agreements` (
114 `id` int(11) NOT NULL AUTO_INCREMENT,
115 `memid` int(11) NOT NULL,
116 `secmemid` int(11) DEFAULT NULL,
117 `document` varchar(50) DEFAULT NULL,
118 `date` datetime DEFAULT NULL,
119 `active` int(1) NOT NULL,
120 `method` varchar(100) NOT NULL,
121 `comment` varchar(100) DEFAULT NULL,
123 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
125 DROP TABLE IF EXISTS `certs`;
126 CREATE TABLE `certs` (
127 `id` int(11) NOT NULL AUTO_INCREMENT,
128 `memid` int(11) NOT NULL DEFAULT '0',
129 `serial` varchar(50) NOT NULL DEFAULT '',
130 `CN` varchar(255) NOT NULL DEFAULT '',
131 `subject` text NOT NULL,
132 `keytype` char(2) NOT NULL DEFAULT 'NS',
133 `codesign` tinyint(1) NOT NULL DEFAULT '0',
134 `md` enum('md5','sha1','sha256','sha512') NOT NULL DEFAULT 'sha512',
135 `profile` int(3) NOT NULL,
137 `csr_name` varchar(255) NOT NULL DEFAULT '',
138 `csr_type` enum('CSR', 'SPKAC') NOT NULL,
139 `crt_name` varchar(255) NOT NULL DEFAULT '',
140 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
141 `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
142 `revoked` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
143 `expire` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
144 `renewed` tinyint(1) NOT NULL DEFAULT '0',
145 `disablelogin` int(1) NOT NULL DEFAULT '0',
146 `pkhash` char(40) DEFAULT NULL,
147 `certhash` char(40) DEFAULT NULL,
148 `description` varchar(100) NOT NULL DEFAULT '',
150 KEY `emailcerts_pkhash` (`pkhash`),
151 KEY `revoked` (`revoked`),
152 KEY `created` (`created`),
153 KEY `memid` (`memid`),
154 KEY `serial` (`serial`),
155 KEY `stats_emailcerts_expire` (`expire`),
156 KEY `emailcrt` (`crt_name`)
157 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
159 DROP TABLE IF EXISTS `clientcerts`;
160 CREATE TABLE `clientcerts` (
161 `id` int(11) NOT NULL,
162 `disablelogin` int(1) NOT NULL DEFAULT '0',
165 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
167 DROP TABLE IF EXISTS `profiles`;
168 CREATE TABLE `profiles` (
169 `id` int(3) NOT NULL AUTO_INCREMENT,
170 `keyname` varchar(60) NOT NULL,
171 `keyUsage` varchar(100) NOT NULL,
172 `extendedKeyUsage` varchar(100) NOT NULL,
173 `rootcert` int(2) NOT NULL DEFAULT '1',
174 `name` varchar(100) NOT NULL,
177 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
178 INSERT INTO `profiles` SET rootcert=0, keyname='client', name='ssl-client (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
179 INSERT INTO `profiles` SET rootcert=0, keyname='mail', name='mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
180 INSERT INTO `profiles` SET rootcert=0, keyname='client-mail', name='ssl-client + mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
181 INSERT INTO `profiles` SET rootcert=0, keyname='server', name='ssl-server (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
183 INSERT INTO `profiles` SET rootcert=1, keyname='client-a', name='ssl-client (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
184 INSERT INTO `profiles` SET rootcert=1, keyname='mail-a', name='mail (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
185 INSERT INTO `profiles` SET rootcert=1, keyname='client-mail-a', name='ssl-client + mail(assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
186 INSERT INTO `profiles` SET rootcert=1, keyname='server-a', name='ssl-server (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
188 -- 0=unassured, 1=assured, 2=codesign, 3=orga, 4=orga-sign
189 DROP TABLE IF EXISTS `subjectAlternativeNames`;
190 CREATE TABLE `subjectAlternativeNames` (
191 `certId` int(11) NOT NULL,
192 `contents` varchar(50) NOT NULL,
193 `type` enum('email','DNS') NOT NULL
194 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
199 DROP TABLE IF EXISTS `jobs`;
200 CREATE TABLE `jobs` (
201 `id` int(11) NOT NULL AUTO_INCREMENT,
202 `targetId` int(11) NOT NULL,
203 `task` enum('sign','revoke') NOT NULL,
204 `state` enum('open', 'done', 'error') NOT NULL DEFAULT 'open',
205 `warning` int(2) NOT NULL DEFAULT '0',
207 `executeTo` VARCHAR(11),
209 KEY `state` (`state`)
210 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
213 DROP TABLE IF EXISTS `notary`;
214 CREATE TABLE `notary` (
215 `id` int(11) NOT NULL AUTO_INCREMENT,
216 `from` int(11) NOT NULL DEFAULT '0',
217 `to` int(11) NOT NULL DEFAULT '0',
218 # total points that have been entered
219 `points` int(3) NOT NULL DEFAULT '0',
220 # awarded and the "experience points" are calculated virtually
221 # Face to Face is default, TOPUP is for the remaining 30Points after two TTP
222 # TTP is default ttp assurance
223 `method` enum('Face to Face Meeting', 'TOPUP', 'TTP-Assisted') NOT NULL DEFAULT 'Face to Face Meeting',
224 `location` varchar(255) NOT NULL DEFAULT '',
225 `date` varchar(255) NOT NULL DEFAULT '',
226 # date when assurance was entered
227 `when` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
229 `expire` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
231 `sponsor` int(11) NOT NULL DEFAULT '0',
232 # date when assurance was deleted (or 0)
233 `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
237 KEY `stats_notary_when` (`when`),
238 KEY `stats_notary_method` (`method`)
239 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
242 DROP TABLE IF EXISTS `cats_passed`;
243 CREATE TABLE `cats_passed` (
244 `id` int(11) NOT NULL AUTO_INCREMENT,
245 `user_id` int(11) NOT NULL,
246 `variant_id` int(11) NOT NULL,
247 `pass_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
249 UNIQUE KEY `test_passed` (`user_id`,`variant_id`,`pass_date`)
250 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
252 # --------------------------------------------------------
255 # Table structure for table `cats_type`
258 DROP TABLE IF EXISTS `cats_type`;
259 CREATE TABLE `cats_type` (
260 `id` int(11) NOT NULL AUTO_INCREMENT,
261 `type_text` varchar(255) NOT NULL,
263 UNIQUE KEY `type_text` (`type_text`)
264 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
266 DROP TABLE IF EXISTS `arbitrations`;
267 CREATE TABLE IF NOT EXISTS `arbitrations` (
268 `user` int(11) NOT NULL,
269 `arbitration` varchar(20) NOT NULL,
270 PRIMARY KEY (`user`,`arbitration`)
271 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
273 DROP TABLE IF EXISTS `user_groups`;
274 CREATE TABLE IF NOT EXISTS `user_groups` (
275 `id` int(11) NOT NULL AUTO_INCREMENT,
276 `user` int(11) NOT NULL,
277 `permission` enum('supporter','arbitrator','blockedassuree','blockedassurer','ttp-assuer','ttp-applicant', 'codesigning') NOT NULL,
278 `granted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
279 `deleted` timestamp NULL DEFAULT NULL,
280 `grantedby` int(11) NOT NULL,
281 `revokedby` int(11) DEFAULT NULL,
283 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;