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 `creator` int(11) NOT NULL,
45 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
47 DROP TABLE IF EXISTS `domains`;
48 CREATE TABLE `domains` (
49 `id` int(11) NOT NULL AUTO_INCREMENT,
50 `memid` int(11) NOT NULL,
51 `domain` varchar(255) NOT NULL,
52 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
53 `modified` datetime NULL DEFAULT NULL,
54 `deleted` datetime NULL DEFAULT NULL,
56 KEY `memid` (`memid`),
57 KEY `domain` (`domain`),
58 KEY `stats_domains_deleted` (`deleted`)
59 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
61 DROP TABLE IF EXISTS `emails`;
62 CREATE TABLE `emails` (
63 `id` int(11) NOT NULL AUTO_INCREMENT,
64 `memid` int(11) NOT NULL DEFAULT '0',
65 `email` varchar(255) NOT NULL DEFAULT '',
66 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
67 `modified` datetime NULL DEFAULT NULL,
68 `deleted` datetime NULL DEFAULT NULL,
69 `hash` varchar(50) NOT NULL DEFAULT '',
70 `attempts` int(1) NOT NULL DEFAULT '0',
72 KEY `memid` (`memid`),
73 KEY `stats_email_hash` (`hash`),
74 KEY `stats_email_deleted` (`deleted`),
76 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
78 DROP TABLE IF EXISTS `emailPinglog`;
79 CREATE TABLE `emailPinglog` (
80 `when` datetime NOT NULL,
81 `uid` int(11) NOT NULL,
82 `email` varchar(255) NOT NULL,
83 `type` enum('fast', 'active') NOT NULL,
84 `status` enum('open', 'success', 'failed') NOT NULL,
85 `result` varchar(255) NOT NULL
86 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
88 DROP TABLE IF EXISTS `pingconfig`;
89 CREATE TABLE `pingconfig` (
90 `id` int(13) NOT NULL AUTO_INCREMENT,
91 `domainid` int(11) NOT NULL,
92 `type` enum('email', 'ssl', 'http', 'dns') NOT NULL,
93 `info` varchar(255) NOT NULL,
94 `reping` enum('y','n') NOT NULL DEFAULT 'n',
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,
147 `csr_name` varchar(255) NOT NULL DEFAULT '',
148 `csr_type` enum('CSR', 'SPKAC') NOT NULL,
149 `crt_name` varchar(255) NOT NULL DEFAULT '',
150 `created` timestamp NULL DEFAULT NULL,
151 `modified` datetime NULL DEFAULT NULL,
152 `revoked` datetime NULL DEFAULT NULL,
153 `expire` datetime NULL DEFAULT NULL,
154 `renewed` tinyint(1) NOT NULL DEFAULT '0',
155 `disablelogin` int(1) NOT NULL DEFAULT '0',
156 `pkhash` char(40) DEFAULT NULL,
157 `certhash` char(40) DEFAULT NULL,
158 `description` varchar(100) NOT NULL DEFAULT '',
160 KEY `emailcerts_pkhash` (`pkhash`),
161 KEY `revoked` (`revoked`),
162 KEY `created` (`created`),
163 KEY `memid` (`memid`),
164 KEY `serial` (`serial`),
165 KEY `stats_emailcerts_expire` (`expire`),
166 KEY `emailcrt` (`crt_name`)
167 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
170 DROP TABLE IF EXISTS `certAvas`;
171 CREATE TABLE `certAvas` (
172 `certid` int(11) NOT NULL,
173 `name` varchar(20) NOT NULL,
174 `value` varchar(255) NOT NULL,
176 PRIMARY KEY (`certid`, `name`)
177 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
179 DROP TABLE IF EXISTS `clientcerts`;
180 CREATE TABLE `clientcerts` (
181 `id` int(11) NOT NULL,
182 `disablelogin` int(1) NOT NULL DEFAULT '0',
185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
187 DROP TABLE IF EXISTS `profiles`;
188 CREATE TABLE `profiles` (
189 `id` int(3) NOT NULL AUTO_INCREMENT,
190 `keyname` varchar(60) NOT NULL,
191 `keyUsage` varchar(100) NOT NULL,
192 `extendedKeyUsage` varchar(100) NOT NULL,
193 `rootcert` int(2) NOT NULL DEFAULT '1',
194 `name` varchar(100) NOT NULL,
197 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
199 INSERT INTO `profiles` SET rootcert=0, keyname='client', name='ssl-client (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
200 INSERT INTO `profiles` SET rootcert=0, keyname='mail', name='mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
201 INSERT INTO `profiles` SET rootcert=0, keyname='client-mail', name='ssl-client + mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
202 INSERT INTO `profiles` SET rootcert=0, keyname='server', name='ssl-server (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
204 INSERT INTO `profiles` SET rootcert=1, keyname='client-a', name='ssl-client (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
205 INSERT INTO `profiles` SET rootcert=1, keyname='mail-a', name='mail (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
206 INSERT INTO `profiles` SET rootcert=1, keyname='client-mail-a', name='ssl-client + mail(assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
207 INSERT INTO `profiles` SET rootcert=1, keyname='server-a', name='ssl-server (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
208 INSERT INTO `profiles` SET rootcert=2, keyname='code-a', name='codesign (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='codeSigning, msCodeInd, msCodeCom';
210 INSERT INTO `profiles` SET rootcert=3, keyname='client-orga', name='ssl-client (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
211 INSERT INTO `profiles` SET rootcert=3, keyname='mail-orga', name='mail (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
212 INSERT INTO `profiles` SET rootcert=3, keyname='client-mail-orga', name='ssl-client + mail(orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
213 INSERT INTO `profiles` SET rootcert=3, keyname='server-orga', name='ssl-server (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
214 INSERT INTO `profiles` SET rootcert=4, keyname='code-orga', name='codesign (orga)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='codeSigning, msCodeInd, msCodeCom';
216 -- 0=unassured, 1=assured, 2=codesign, 3=orga, 4=orga-sign
217 DROP TABLE IF EXISTS `subjectAlternativeNames`;
218 CREATE TABLE `subjectAlternativeNames` (
219 `certId` int(11) NOT NULL,
220 `contents` varchar(50) NOT NULL,
221 `type` enum('email','DNS') NOT NULL
222 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
227 DROP TABLE IF EXISTS `jobs`;
228 CREATE TABLE `jobs` (
229 `id` int(11) NOT NULL AUTO_INCREMENT,
230 `targetId` int(11) NOT NULL,
231 `task` enum('sign','revoke') NOT NULL,
232 `state` enum('open', 'done', 'error') NOT NULL DEFAULT 'open',
233 `warning` int(2) NOT NULL DEFAULT '0',
235 `executeTo` VARCHAR(11),
237 KEY `state` (`state`)
238 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
241 DROP TABLE IF EXISTS `notary`;
242 CREATE TABLE `notary` (
243 `id` int(11) NOT NULL AUTO_INCREMENT,
244 `from` int(11) NOT NULL DEFAULT '0',
245 `to` int(11) NOT NULL DEFAULT '0',
246 # total points that have been entered
247 `points` int(3) NOT NULL DEFAULT '0',
248 # awarded and the "experience points" are calculated virtually
249 # Face to Face is default, TOPUP is for the remaining 30Points after two TTP
250 # TTP is default ttp assurance
251 `method` enum('Face to Face Meeting', 'TOPUP', 'TTP-Assisted') NOT NULL DEFAULT 'Face to Face Meeting',
252 `location` varchar(255) NOT NULL DEFAULT '',
253 `date` varchar(255) NOT NULL DEFAULT '',
254 # date when assurance was entered
255 `when` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
257 `expire` datetime NULL DEFAULT NULL,
259 `sponsor` int(11) NOT NULL DEFAULT '0',
260 # date when assurance was deleted (or 0)
261 `deleted` datetime NULL DEFAULT NULL,
265 KEY `stats_notary_when` (`when`),
266 KEY `stats_notary_method` (`method`)
267 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
270 DROP TABLE IF EXISTS `cats_passed`;
271 CREATE TABLE `cats_passed` (
272 `id` int(11) NOT NULL AUTO_INCREMENT,
273 `user_id` int(11) NOT NULL,
274 `variant_id` int(11) NOT NULL,
275 `pass_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
277 UNIQUE KEY `test_passed` (`user_id`,`variant_id`,`pass_date`)
278 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
280 # --------------------------------------------------------
283 # Table structure for table `cats_type`
286 DROP TABLE IF EXISTS `cats_type`;
287 CREATE TABLE `cats_type` (
288 `id` int(11) NOT NULL AUTO_INCREMENT,
289 `type_text` varchar(255) NOT NULL,
291 UNIQUE KEY `type_text` (`type_text`)
292 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
294 DROP TABLE IF EXISTS `arbitrations`;
295 CREATE TABLE IF NOT EXISTS `arbitrations` (
296 `user` int(11) NOT NULL,
297 `arbitration` varchar(20) NOT NULL,
298 PRIMARY KEY (`user`,`arbitration`)
299 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
301 DROP TABLE IF EXISTS `user_groups`;
302 CREATE TABLE IF NOT EXISTS `user_groups` (
303 `id` int(11) NOT NULL AUTO_INCREMENT,
304 `user` int(11) NOT NULL,
305 `permission` enum('supporter','arbitrator','blockedassuree','blockedassurer','blockedlogin','ttp-assurer','ttp-applicant', 'codesigning', 'orgassurer') NOT NULL,
306 `granted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
307 `deleted` timestamp NULL DEFAULT NULL,
308 `grantedby` int(11) NOT NULL,
309 `revokedby` int(11) DEFAULT NULL,
311 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
313 DROP TABLE IF EXISTS `org_admin`;
314 CREATE TABLE IF NOT EXISTS `org_admin` (
315 `orgid` int(11) NOT NULL,
316 `memid` int(11) NOT NULL,
317 `master` enum('y', 'n') NOT NULL,
318 `creator` int(11) NOT NULL,
319 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
320 `deleter` int(11) NULL DEFAULT NULL,
321 `deleted` timestamp NULL DEFAULT NULL,
322 KEY (`orgid`, `memid`)
323 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
325 DROP TABLE IF EXISTS `adminLog`;
326 CREATE TABLE `adminLog` (
327 `when` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
328 `uid` int(11) unsigned NOT NULL,
329 `admin` int(11) unsigned NOT NULL,
330 `type` varchar(100) NOT NULL DEFAULT '',
331 `information` varchar(50) NOT NULL DEFAULT '',
333 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;