]> WPIA git - gigi.git/blob - doc/tableStructure.sql
Sign with different root certificates.
[gigi.git] / doc / tableStructure.sql
1 DROP TABLE IF EXISTS `users`;
2 CREATE TABLE `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   `admin` tinyint(1) NOT NULL DEFAULT '0',
17   `language` varchar(5) NOT NULL DEFAULT '',
18   `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
19   `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
20   `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
21   `locked` tinyint(1) NOT NULL DEFAULT '0',
22   `assurer_blocked` tinyint(1) NOT NULL DEFAULT '0',
23   PRIMARY KEY (`id`),
24   KEY `ccid` (`ccid`),
25   KEY `regid` (`regid`),
26   KEY `locid` (`locid`),
27   KEY `email` (`email`),
28   KEY `stats_users_created` (`created`),
29   KEY `stats_users_verified` (`verified`),
30   KEY `userverified` (`verified`)
31 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
32
33
34 DROP TABLE IF EXISTS `domains`;
35 CREATE TABLE `domains` (
36   `id` int(11) NOT NULL AUTO_INCREMENT,
37   `memid` int(11) NOT NULL,
38   `domain` varchar(255) NOT NULL,
39   `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
40   `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
41   `deleted` datetime DEFAULT NULL,
42   PRIMARY KEY (`id`),
43   KEY `memid` (`memid`),
44   KEY `domain` (`domain`),
45   KEY `stats_domains_deleted` (`deleted`)
46 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
47
48 DROP TABLE IF EXISTS `emails`;
49 CREATE TABLE `emails` (
50   `id` int(11) NOT NULL AUTO_INCREMENT,
51   `memid` int(11) NOT NULL DEFAULT '0',
52   `email` varchar(255) NOT NULL DEFAULT '',
53   `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
54   `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
55   `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
56   `hash` varchar(50) NOT NULL DEFAULT '',
57   `attempts` int(1) NOT NULL DEFAULT '0',
58   PRIMARY KEY (`id`),
59   KEY `memid` (`memid`),
60   KEY `stats_email_hash` (`hash`),
61   KEY `stats_email_deleted` (`deleted`),
62   KEY `email` (`email`)
63 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
64
65 DROP TABLE IF EXISTS `pinglog`;
66 CREATE TABLE `pinglog` (
67   `when` datetime NOT NULL,
68   `uid` int(11) NOT NULL,
69   `email` varchar(255) NOT NULL,
70   `result` varchar(255) NOT NULL
71 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
72
73 DROP TABLE IF EXISTS `baddomains`;
74 CREATE TABLE `baddomains` (
75   `domain` varchar(255) NOT NULL DEFAULT ''
76 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
77
78
79 DROP TABLE IF EXISTS `alerts`;
80 CREATE TABLE `alerts` (
81   `memid` int(11) NOT NULL DEFAULT '0',
82   `general` tinyint(1) NOT NULL DEFAULT '0',
83   `country` tinyint(1) NOT NULL DEFAULT '0',
84   `regional` tinyint(1) NOT NULL DEFAULT '0',
85   `radius` tinyint(1) NOT NULL DEFAULT '0',
86   PRIMARY KEY (`memid`)
87 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
88
89 DROP TABLE IF EXISTS `user_agreements`;
90 CREATE TABLE `user_agreements` (
91   `id` int(11) NOT NULL AUTO_INCREMENT,
92   `memid` int(11) NOT NULL,
93   `secmemid` int(11) DEFAULT NULL,
94   `document` varchar(50) DEFAULT NULL,
95   `date` datetime DEFAULT NULL,
96   `active` int(1) NOT NULL,
97   `method` varchar(100) NOT NULL,
98   `comment` varchar(100) DEFAULT NULL,
99   PRIMARY KEY (`id`)
100 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
101
102 DROP TABLE IF EXISTS `certs`;
103 CREATE TABLE `certs` (
104   `id` int(11) NOT NULL AUTO_INCREMENT,
105   `memid` int(11) NOT NULL DEFAULT '0',
106   `serial` varchar(50) NOT NULL DEFAULT '',
107   `CN` varchar(255) NOT NULL DEFAULT '',
108   `subject` text NOT NULL,
109   `keytype` char(2) NOT NULL DEFAULT 'NS',
110   `codesign` tinyint(1) NOT NULL DEFAULT '0',
111   `md` enum('md5','sha1','sha256','sha512') NOT NULL DEFAULT 'sha512',
112   `profile` int(3) NOT NULL,
113
114   `csr_name` varchar(255) NOT NULL DEFAULT '',
115   `csr_type` enum('CSR', 'SPKAC') NOT NULL,
116   `crt_name` varchar(255) NOT NULL DEFAULT '',
117   `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
118   `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
119   `revoked` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
120   `expire` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
121   `renewed` tinyint(1) NOT NULL DEFAULT '0',
122   `disablelogin` int(1) NOT NULL DEFAULT '0',
123   `pkhash` char(40) DEFAULT NULL,
124   `certhash` char(40) DEFAULT NULL,
125   `description` varchar(100) NOT NULL DEFAULT '',
126   PRIMARY KEY (`id`),
127   KEY `emailcerts_pkhash` (`pkhash`),
128   KEY `revoked` (`revoked`),
129   KEY `created` (`created`),
130   KEY `memid` (`memid`),
131   KEY `serial` (`serial`),
132   KEY `stats_emailcerts_expire` (`expire`),
133   KEY `emailcrt` (`crt_name`)
134 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
135
136 DROP TABLE IF EXISTS `clientcerts`;
137 CREATE TABLE `clientcerts` (
138   `id` int(11) NOT NULL,
139   `disablelogin` int(1) NOT NULL DEFAULT '0',
140
141   PRIMARY KEY (`id`)
142 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
143
144 DROP TABLE IF EXISTS `profiles`;
145 CREATE TABLE `profiles` (
146   `id` int(3) NOT NULL AUTO_INCREMENT,
147   `keyname` varchar(60) NOT NULL,
148   `keyUsage` varchar(100) NOT NULL,
149   `extendedKeyUsage` varchar(100) NOT NULL,
150   `rootcert` int(2) NOT NULL DEFAULT '1',
151   `name` varchar(100) NOT NULL,
152   PRIMARY KEY (`id`),
153   UNIQUE (`keyname`)
154 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
155 INSERT INTO `profiles` SET rootcert=0, keyname='client', name='ssl-client (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
156 INSERT INTO `profiles` SET rootcert=0, keyname='mail',  name='mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
157 INSERT INTO `profiles` SET rootcert=0, keyname='client-mail', name='ssl-client + mail (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
158 INSERT INTO `profiles` SET rootcert=0, keyname='server', name='ssl-server (unassured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
159
160 INSERT INTO `profiles` SET rootcert=1, keyname='client-a', name='ssl-client (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth';
161 INSERT INTO `profiles` SET rootcert=1, keyname='mail-a',  name='mail (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='emailProtection';
162 INSERT INTO `profiles` SET rootcert=1, keyname='client-mail-a', name='ssl-client + mail(assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='clientAuth, emailProtection';
163 INSERT INTO `profiles` SET rootcert=1, keyname='server-a', name='ssl-server (assured)', keyUsage='digitalSignature, keyEncipherment, keyAgreement', extendedKeyUsage='serverAuth';
164
165 -- 0=unassured, 1=assured, 2=codesign, 3=orga, 4=orga-sign
166 DROP TABLE IF EXISTS `subjectAlternativeNames`;
167 CREATE TABLE `subjectAlternativeNames` (
168   `certId` int(11) NOT NULL,
169   `contents` varchar(50) NOT NULL,
170   `type` enum('email','DNS') NOT NULL
171 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
172
173
174
175
176 DROP TABLE IF EXISTS `jobs`;
177 CREATE TABLE `jobs` (
178   `id` int(11) NOT NULL AUTO_INCREMENT,
179   `targetId` int(11) NOT NULL,
180   `task` enum('sign','revoke') NOT NULL,
181   `state` enum('open', 'done', 'error') NOT NULL DEFAULT 'open',
182   `warning` int(2) NOT NULL DEFAULT '0',
183   PRIMARY KEY (`id`),
184   KEY `state` (`state`)
185 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
186
187
188 DROP TABLE IF EXISTS `notary`;
189 CREATE TABLE `notary` (
190   `id` int(11) NOT NULL AUTO_INCREMENT,
191   `from` int(11) NOT NULL DEFAULT '0',
192   `to` int(11) NOT NULL DEFAULT '0',
193   `awarded` int(3) NOT NULL DEFAULT '0',
194   `points` int(3) NOT NULL DEFAULT '0',
195   `method` enum('Face to Face Meeting','Trusted Third Parties','Thawte Points Transfer','Administrative Increase','CT Magazine - Germany','Temporary Increase','Unknown','TOPUP','TTP-Assisted') NOT NULL DEFAULT 'Face to Face Meeting',
196   `location` varchar(255) NOT NULL DEFAULT '',
197   `date` varchar(255) NOT NULL DEFAULT '',
198   `when` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
199   `expire` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
200   `sponsor` int(11) NOT NULL DEFAULT '0',
201   `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
202   PRIMARY KEY (`id`),
203   KEY `from` (`from`),
204   KEY `to` (`to`),
205   KEY `from_2` (`from`),
206   KEY `to_2` (`to`),
207   KEY `stats_notary_when` (`when`),
208   KEY `stats_notary_method` (`method`)
209 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
210
211
212 DROP TABLE IF EXISTS `cats_passed`;
213 CREATE TABLE `cats_passed` (
214   `id` int(11) NOT NULL AUTO_INCREMENT,
215   `user_id` int(11) NOT NULL,
216   `variant_id` int(11) NOT NULL,
217   `pass_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
218   PRIMARY KEY (`id`),
219   UNIQUE KEY `test_passed` (`user_id`,`variant_id`,`pass_date`)
220 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
221
222 # --------------------------------------------------------
223
224 #
225 # Table structure for table `cats_type`
226 #
227
228 DROP TABLE IF EXISTS `cats_type`;
229 CREATE TABLE `cats_type` (
230   `id` int(11) NOT NULL AUTO_INCREMENT,
231   `type_text` varchar(255) NOT NULL,
232   PRIMARY KEY (`id`),
233   UNIQUE KEY `type_text` (`type_text`)
234 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;