1 DROP TABLE IF EXISTS `certOwners`;
2 CREATE TABLE `certOwners` (
3 `id` int(11) NOT NULL AUTO_INCREMENT,
4 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
5 `modified` timestamp NULL DEFAULT NULL,
6 `deleted` timestamp NULL DEFAULT NULL,
8 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
10 DROP TABLE IF EXISTS `users`;
11 CREATE TABLE `users` (
12 `id` int(11) NOT NULL,
13 `email` varchar(255) NOT NULL DEFAULT '',
14 `password` varchar(255) NOT NULL DEFAULT '',
15 `fname` varchar(255) NOT NULL DEFAULT '',
16 `mname` varchar(255) NOT NULL DEFAULT '',
17 `lname` varchar(255) NOT NULL DEFAULT '',
18 `suffix` varchar(50) NOT NULL DEFAULT '',
19 `dob` date NOT NULL DEFAULT '0000-00-00',
20 `verified` int(1) NOT NULL DEFAULT '0',
21 `ccid` int(3) NOT NULL DEFAULT '0',
22 `regid` int(5) NOT NULL DEFAULT '0',
23 `locid` int(7) NOT NULL DEFAULT '0',
24 `listme` int(1) NOT NULL DEFAULT '0',
25 `contactinfo` varchar(255) NOT NULL DEFAULT '',
26 `language` varchar(5) NOT NULL DEFAULT '',
29 KEY `regid` (`regid`),
30 KEY `locid` (`locid`),
31 KEY `email` (`email`),
32 KEY `stats_users_verified` (`verified`)
33 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36 DROP TABLE IF EXISTS `organisations`;
37 CREATE TABLE IF NOT EXISTS `organisations` (
38 `id` int(11) NOT NULL,
39 `name` varchar(100) NOT NULL,
40 `state` varchar(2) NOT NULL,
41 `province` varchar(100) NOT NULL,
42 `city` varchar(100) NOT NULL,
43 `contactEmail` varchar(100) NOT NULL,
44 `creator` int(11) NOT NULL,
46 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
48 DROP TABLE IF EXISTS `domains`;
49 CREATE TABLE `domains` (
50 `id` int(11) NOT NULL AUTO_INCREMENT,
51 `memid` int(11) NOT NULL,
52 `domain` varchar(255) NOT NULL,
53 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
54 `modified` datetime NULL DEFAULT NULL,
55 `deleted` datetime NULL DEFAULT NULL,
57 KEY `memid` (`memid`),
58 KEY `domain` (`domain`),
59 KEY `stats_domains_deleted` (`deleted`)
60 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
62 DROP TABLE IF EXISTS `emails`;
63 CREATE TABLE `emails` (
64 `id` int(11) NOT NULL AUTO_INCREMENT,
65 `memid` int(11) NOT NULL DEFAULT '0',
66 `email` varchar(255) NOT NULL DEFAULT '',
67 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
68 `modified` datetime NULL DEFAULT NULL,
69 `deleted` datetime NULL DEFAULT NULL,
70 `hash` varchar(50) NOT NULL DEFAULT '',
71 `attempts` int(1) NOT NULL DEFAULT '0',
73 KEY `memid` (`memid`),
74 KEY `stats_email_hash` (`hash`),
75 KEY `stats_email_deleted` (`deleted`),
77 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
79 DROP TABLE IF EXISTS `emailPinglog`;
80 CREATE TABLE `emailPinglog` (
81 `when` datetime NOT NULL,
82 `uid` int(11) NOT NULL,
83 `email` varchar(255) NOT NULL,
84 `type` enum('fast', 'active') NOT NULL,
85 `status` enum('open', 'success', 'failed') NOT NULL,
86 `result` varchar(255) NOT NULL
87 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
89 DROP TABLE IF EXISTS `pingconfig`;
90 CREATE TABLE `pingconfig` (
91 `id` int(13) NOT NULL AUTO_INCREMENT,
92 `domainid` int(11) NOT NULL,
93 `type` enum('email', 'ssl', 'http', 'dns') NOT NULL,
94 `info` varchar(255) NOT NULL,
96 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
99 DROP TABLE IF EXISTS `domainPinglog`;
100 CREATE TABLE `domainPinglog` (
101 `when` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
102 `configId` int(13) NOT NULL,
103 `state` enum('open', 'success', 'failed') NOT NULL,
104 `challenge` varchar(16),
105 `result` varchar(255)
106 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
108 DROP TABLE IF EXISTS `baddomains`;
109 CREATE TABLE `baddomains` (
110 `domain` varchar(255) NOT NULL DEFAULT ''
111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
114 DROP TABLE IF EXISTS `alerts`;
115 CREATE TABLE `alerts` (
116 `memid` int(11) NOT NULL DEFAULT '0',
117 `general` tinyint(1) NOT NULL DEFAULT '0',
118 `country` tinyint(1) NOT NULL DEFAULT '0',
119 `regional` tinyint(1) NOT NULL DEFAULT '0',
120 `radius` tinyint(1) NOT NULL DEFAULT '0',
121 PRIMARY KEY (`memid`)
122 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
124 DROP TABLE IF EXISTS `user_agreements`;
125 CREATE TABLE `user_agreements` (
126 `id` int(11) NOT NULL AUTO_INCREMENT,
127 `memid` int(11) NOT NULL,
128 `secmemid` int(11) DEFAULT NULL,
129 `document` varchar(50) DEFAULT NULL,
130 `date` datetime DEFAULT NULL,
131 `active` int(1) NOT NULL,
132 `method` varchar(100) NOT NULL,
133 `comment` varchar(100) DEFAULT NULL,
135 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
137 DROP TABLE IF EXISTS `certs`;
138 CREATE TABLE `certs` (
139 `id` int(11) NOT NULL AUTO_INCREMENT,
140 `memid` int(11) NOT NULL DEFAULT '0',
141 `serial` varchar(50) NOT NULL DEFAULT '',
142 `keytype` char(2) NOT NULL DEFAULT 'NS',
143 `codesign` tinyint(1) NOT NULL DEFAULT '0',
144 `md` enum('md5','sha1','sha256','sha512') NOT NULL DEFAULT 'sha512',
145 `profile` int(3) NOT NULL,
146 `caid` int(3) NULL DEFAULT NULL,
148 `csr_name` varchar(255) NOT NULL DEFAULT '',
149 `csr_type` enum('CSR', 'SPKAC') NOT NULL,
150 `crt_name` varchar(255) NOT NULL DEFAULT '',
151 `created` timestamp NULL DEFAULT NULL,
152 `modified` datetime NULL DEFAULT NULL,
153 `revoked` datetime NULL DEFAULT NULL,
154 `expire` datetime NULL DEFAULT NULL,
155 `renewed` tinyint(1) NOT NULL DEFAULT '0',
156 `disablelogin` int(1) NOT NULL DEFAULT '0',
157 `pkhash` char(40) DEFAULT NULL,
158 `certhash` char(40) DEFAULT NULL,
159 `description` varchar(100) NOT NULL DEFAULT '',
161 KEY `emailcerts_pkhash` (`pkhash`),
162 KEY `revoked` (`revoked`),
163 KEY `created` (`created`),
164 KEY `memid` (`memid`),
165 KEY `serial` (`serial`),
166 KEY `stats_emailcerts_expire` (`expire`),
167 KEY `emailcrt` (`crt_name`)
168 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
171 DROP TABLE IF EXISTS `certAvas`;
172 CREATE TABLE `certAvas` (
173 `certid` int(11) NOT NULL,
174 `name` varchar(20) NOT NULL,
175 `value` varchar(255) NOT NULL,
177 PRIMARY KEY (`certid`, `name`)
178 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
180 DROP TABLE IF EXISTS `clientcerts`;
181 CREATE TABLE `clientcerts` (
182 `id` int(11) NOT NULL,
183 `disablelogin` int(1) NOT NULL DEFAULT '0',
186 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
188 DROP TABLE IF EXISTS `profiles`;
189 CREATE TABLE `profiles` (
190 `id` int(3) NOT NULL AUTO_INCREMENT,
191 `keyname` varchar(60) NOT NULL,
192 `keyUsage` varchar(100) NOT NULL,
193 `extendedKeyUsage` varchar(100) NOT NULL,
194 `rootcert` int(2) NOT NULL DEFAULT '1',
195 `name` varchar(100) NOT NULL,
198 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
200 INSERT INTO `profiles` SET rootcert=0, keyname='client', name='ssl-client (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
201 INSERT INTO `profiles` SET rootcert=0, keyname='mail', name='mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
202 INSERT INTO `profiles` SET rootcert=0, keyname='client-mail', name='ssl-client + mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
203 INSERT INTO `profiles` SET rootcert=0, keyname='server', name='ssl-server (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
205 INSERT INTO `profiles` SET rootcert=1, keyname='client-a', name='ssl-client (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
206 INSERT INTO `profiles` SET rootcert=1, keyname='mail-a', name='mail (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
207 INSERT INTO `profiles` SET rootcert=1, keyname='client-mail-a', name='ssl-client + mail(assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
208 INSERT INTO `profiles` SET rootcert=1, keyname='server-a', name='ssl-server (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
209 INSERT INTO `profiles` SET rootcert=2, keyname='code-a', name='codesign (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='codeSigning, msCodeInd, msCodeCom';
211 INSERT INTO `profiles` SET rootcert=3, keyname='client-orga', name='ssl-client (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
212 INSERT INTO `profiles` SET rootcert=3, keyname='mail-orga', name='mail (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
213 INSERT INTO `profiles` SET rootcert=3, keyname='client-mail-orga', name='ssl-client + mail(orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
214 INSERT INTO `profiles` SET rootcert=3, keyname='server-orga', name='ssl-server (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
215 INSERT INTO `profiles` SET rootcert=4, keyname='code-orga', name='codesign (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='codeSigning, msCodeInd, msCodeCom';
217 -- 0=unassured, 1=assured, 2=codesign, 3=orga, 4=orga-sign
218 DROP TABLE IF EXISTS `subjectAlternativeNames`;
219 CREATE TABLE `subjectAlternativeNames` (
220 `certId` int(11) NOT NULL,
221 `contents` varchar(50) NOT NULL,
222 `type` enum('email','DNS') NOT NULL
223 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
225 DROP TABLE IF EXISTS `cacerts`;
226 CREATE TABLE `cacerts` (
227 `id` int(3) NOT NULL AUTO_INCREMENT,
228 `keyname` varchar(60) NOT NULL,
229 `subroot` int(2) NOT NULL,
230 `validFrom` datetime NULL DEFAULT NULL,
231 `validTo` datetime NULL DEFAULT NULL,
234 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
237 DROP TABLE IF EXISTS `jobs`;
238 CREATE TABLE `jobs` (
239 `id` int(11) NOT NULL AUTO_INCREMENT,
240 `targetId` int(11) NOT NULL,
241 `task` enum('sign','revoke') NOT NULL,
242 `state` enum('open', 'done', 'error') NOT NULL DEFAULT 'open',
243 `warning` int(2) NOT NULL DEFAULT '0',
245 `executeTo` VARCHAR(11),
247 KEY `state` (`state`)
248 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
251 DROP TABLE IF EXISTS `notary`;
252 CREATE TABLE `notary` (
253 `id` int(11) NOT NULL AUTO_INCREMENT,
254 `from` int(11) NOT NULL DEFAULT '0',
255 `to` int(11) NOT NULL DEFAULT '0',
256 # total points that have been entered
257 `points` int(3) NOT NULL DEFAULT '0',
258 # awarded and the "experience points" are calculated virtually
259 # Face to Face is default, TOPUP is for the remaining 30Points after two TTP
260 # TTP is default ttp assurance
261 `method` enum('Face to Face Meeting', 'TOPUP', 'TTP-Assisted') NOT NULL DEFAULT 'Face to Face Meeting',
262 `location` varchar(255) NOT NULL DEFAULT '',
263 `date` varchar(255) NOT NULL DEFAULT '',
264 # date when assurance was entered
265 `when` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
267 `expire` datetime NULL DEFAULT NULL,
269 `sponsor` int(11) NOT NULL DEFAULT '0',
270 # date when assurance was deleted (or 0)
271 `deleted` datetime NULL DEFAULT NULL,
275 KEY `stats_notary_when` (`when`),
276 KEY `stats_notary_method` (`method`)
277 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
280 DROP TABLE IF EXISTS `cats_passed`;
281 CREATE TABLE `cats_passed` (
282 `id` int(11) NOT NULL AUTO_INCREMENT,
283 `user_id` int(11) NOT NULL,
284 `variant_id` int(11) NOT NULL,
285 `pass_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
287 UNIQUE KEY `test_passed` (`user_id`,`variant_id`,`pass_date`)
288 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
290 # --------------------------------------------------------
293 # Table structure for table `cats_type`
296 DROP TABLE IF EXISTS `cats_type`;
297 CREATE TABLE `cats_type` (
298 `id` int(11) NOT NULL AUTO_INCREMENT,
299 `type_text` varchar(255) NOT NULL,
301 UNIQUE KEY `type_text` (`type_text`)
302 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
304 DROP TABLE IF EXISTS `arbitrations`;
305 CREATE TABLE IF NOT EXISTS `arbitrations` (
306 `user` int(11) NOT NULL,
307 `arbitration` varchar(20) NOT NULL,
308 PRIMARY KEY (`user`,`arbitration`)
309 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
311 DROP TABLE IF EXISTS `user_groups`;
312 CREATE TABLE IF NOT EXISTS `user_groups` (
313 `id` int(11) NOT NULL AUTO_INCREMENT,
314 `user` int(11) NOT NULL,
315 `permission` enum('supporter','arbitrator','blockedassuree','blockedassurer','blockedlogin','ttp-assurer','ttp-applicant', 'codesigning', 'orgassurer') NOT NULL,
316 `granted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
317 `deleted` timestamp NULL DEFAULT NULL,
318 `grantedby` int(11) NOT NULL,
319 `revokedby` int(11) DEFAULT NULL,
321 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
323 DROP TABLE IF EXISTS `org_admin`;
324 CREATE TABLE IF NOT EXISTS `org_admin` (
325 `orgid` int(11) NOT NULL,
326 `memid` int(11) NOT NULL,
327 `master` enum('y', 'n') NOT NULL,
328 `creator` int(11) NOT NULL,
329 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
330 `deleter` int(11) NULL DEFAULT NULL,
331 `deleted` timestamp NULL DEFAULT NULL,
332 KEY (`orgid`, `memid`)
333 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
335 DROP TABLE IF EXISTS `adminLog`;
336 CREATE TABLE `adminLog` (
337 `when` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
338 `uid` int(11) unsigned NOT NULL,
339 `admin` int(11) unsigned NOT NULL,
340 `type` varchar(100) NOT NULL DEFAULT '',
341 `information` varchar(50) NOT NULL DEFAULT '',
343 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
345 DROP TABLE IF EXISTS `schemeVersion`;
346 CREATE TABLE `schemeVersion` (
347 `version` int(5) NOT NULL,
348 PRIMARY KEY (`version`)
349 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
350 INSERT INTO schemeVersion(version) VALUES(1);