22-- Data from XML files etc.
33--
44
5+ DROP TABLE IF EXISTS ` consinfo` ;
56CREATE TABLE `consinfo ` (
67 ` constituency` varchar (100 ) NOT NULL default ' ' ,
78 ` data_key` varchar (100 ) NOT NULL default ' ' ,
@@ -10,10 +11,11 @@ CREATE TABLE `consinfo` (
1011 KEY ` constituency` (` constituency` )
1112);
1213
14+ DROP TABLE IF EXISTS ` constituency` ;
1315CREATE TABLE `constituency ` (
1416 ` name` varchar (100 ) NOT NULL default ' ' ,
1517 ` main_name` tinyint (1 ) NOT NULL default ' 0' ,
16- ` from_date` date NOT NULL default ' 1000 -01-01' ,
18+ ` from_date` date NOT NULL default ' 0000 -01-01' ,
1719 ` to_date` date NOT NULL default ' 9999-12-31' ,
1820 ` cons_id` int (11 ) default NULL ,
1921 KEY ` from_date` (` from_date` ),
@@ -22,6 +24,7 @@ CREATE TABLE `constituency` (
2224 KEY ` constituency` (` cons_id` )
2325);
2426
27+ DROP TABLE IF EXISTS ` epobject` ;
2528CREATE TABLE `epobject ` (
2629 ` epobject_id` int (11 ) NOT NULL auto_increment,
2730 ` title` varchar (255 ) default NULL ,
@@ -33,15 +36,17 @@ CREATE TABLE `epobject` (
3336 KEY ` type` (` type` )
3437);
3538
39+ DROP TABLE IF EXISTS ` gidredirect` ;
3640CREATE TABLE `gidredirect ` (
3741 ` gid_from` char (60 ) default NULL ,
3842 ` gid_to` char (60 ) default NULL ,
39- ` hdate` date NOT NULL default ' 0000-00-00 ' ,
43+ ` hdate` date NOT NULL default ' 0000-01-01 ' ,
4044 ` major` int (11 ) default NULL ,
4145 UNIQUE KEY ` gid_from` (` gid_from` ),
4246 KEY ` gid_to` (` gid_to` )
4347);
4448
49+ DROP TABLE IF EXISTS ` hansard` ;
4550CREATE TABLE `hansard ` (
4651 ` epobject_id` int (11 ) NOT NULL default ' 0' ,
4752 ` gid` varchar (100 ) default NULL ,
@@ -51,7 +56,7 @@ CREATE TABLE `hansard` (
5156 ` section_id` int (11 ) NOT NULL default ' 0' ,
5257 ` subsection_id` int (11 ) NOT NULL default ' 0' ,
5358 ` hpos` int (11 ) NOT NULL default ' 0' ,
54- ` hdate` date NOT NULL default ' 0000-00-00 ' ,
59+ ` hdate` date NOT NULL default ' 0000-01-01 ' ,
5560 ` htime` time default NULL ,
5661 ` source_url` varchar (255 ) NOT NULL default ' ' ,
5762 ` minor` int (11 ) default NULL ,
@@ -72,6 +77,7 @@ CREATE TABLE `hansard` (
7277 KEY ` source_url` (` source_url` )
7378);
7479
80+ DROP TABLE IF EXISTS ` member` ;
7581CREATE TABLE `member ` (
7682 ` member_id` int (11 ) NOT NULL default ' 0' ,
7783 ` house` int (11 ) default NULL ,
@@ -94,6 +100,7 @@ CREATE TABLE `member` (
94100 KEY ` left_house_house` (` left_house` ,` house` )
95101);
96102
103+ DROP TABLE IF EXISTS ` memberinfo` ;
97104CREATE TABLE `memberinfo ` (
98105 ` member_id` int (11 ) NOT NULL default ' 0' ,
99106 ` data_key` varchar (100 ) NOT NULL default ' ' ,
@@ -103,6 +110,7 @@ CREATE TABLE `memberinfo` (
103110 KEY ` member_id` (` member_id` )
104111);
105112
113+ DROP TABLE IF EXISTS ` moffice` ;
106114CREATE TABLE `moffice ` (
107115 ` moffice_id` int (11 ) NOT NULL auto_increment,
108116 ` dept` varchar (100 ) NOT NULL default ' ' ,
@@ -115,6 +123,7 @@ CREATE TABLE `moffice` (
115123 KEY ` person` (` person` )
116124);
117125
126+ DROP TABLE IF EXISTS ` personinfo` ;
118127CREATE TABLE `personinfo ` (
119128 ` person_id` int (11 ) NOT NULL default ' 0' ,
120129 ` data_key` varchar (100 ) NOT NULL default ' ' ,
@@ -124,6 +133,7 @@ CREATE TABLE `personinfo` (
124133 KEY ` person_id` (` person_id` )
125134);
126135
136+ DROP TABLE IF EXISTS ` postcode_lookup` ;
127137CREATE TABLE `postcode_lookup ` (
128138 ` postcode` varchar (10 ) NOT NULL default ' ' ,
129139 ` name` varchar (100 ) NOT NULL default ' ' ,
@@ -132,13 +142,15 @@ CREATE TABLE `postcode_lookup` (
132142
133143-- each time we index, we increment the batch number;
134144-- can use this to speed up search
145+ DROP TABLE IF EXISTS ` indexbatch` ;
135146CREATE TABLE `indexbatch ` (
136147 ` indexbatch_id` int (11 ) NOT NULL auto_increment,
137148 ` created` datetime default NULL ,
138149 PRIMARY KEY (` indexbatch_id` )
139150);
140151
141152-- For Public Bill Committees originally
153+ DROP TABLE IF EXISTS ` bills` ;
142154CREATE TABLE `bills ` (
143155 ` id` int (11 ) NOT NULL auto_increment,
144156 ` title` varchar (255 ) NOT NULL default ' ' ,
@@ -150,6 +162,7 @@ CREATE TABLE `bills` (
150162 KEY ` title` (` title` )
151163);
152164
165+ DROP TABLE IF EXISTS ` pbc_members` ;
153166CREATE TABLE `pbc_members ` (
154167 ` id` int (11 ) NOT NULL auto_increment,
155168 ` member_id` int (11 ) NOT NULL default ' 0' ,
@@ -162,6 +175,7 @@ CREATE TABLE `pbc_members` (
162175 KEY ` bill_id` (` bill_id` )
163176);
164177
178+ DROP TABLE IF EXISTS ` titles` ;
165179CREATE TABLE `titles ` (
166180 ` title` varchar (190 ) NOT NULL default ' ' ,
167181 PRIMARY KEY (` title` )
@@ -171,27 +185,30 @@ CREATE TABLE `titles` (
171185-- User content tables
172186--
173187
188+ DROP TABLE IF EXISTS ` alerts` ;
174189CREATE TABLE `alerts ` (
175190 ` alert_id` mediumint(8 ) unsigned NOT NULL auto_increment,
176191 ` email` varchar (255 ) NOT NULL default ' ' ,
177192 ` criteria` varchar (255 ) NOT NULL default ' ' ,
178193 ` deleted` tinyint (1 ) NOT NULL default ' 0' ,
179194 ` registrationtoken` varchar (34 ) NOT NULL default ' ' ,
180195 ` confirmed` tinyint (1 ) NOT NULL default ' 0' ,
181- ` created` datetime NOT NULL default ' 0000-00-00 00:00:00' ,
196+ ` created` datetime NOT NULL default ' 0000-01-01 00:00:00' ,
182197 ` recommended` tinyint (1 ) NOT NULL default ' 0' ,
183198 PRIMARY KEY (` alert_id` ),
184199 KEY ` email` (` email` ),
185200 KEY ` confirmed` (` confirmed` ,` deleted` )
186201);
187202
203+ DROP TABLE IF EXISTS ` anonvotes` ;
188204CREATE TABLE `anonvotes ` (
189205 ` epobject_id` int (10 ) unsigned NOT NULL default ' 0' ,
190206 ` yes_votes` int (10 ) unsigned NOT NULL default ' 0' ,
191207 ` no_votes` int (10 ) unsigned NOT NULL default ' 0' ,
192208 PRIMARY KEY (` epobject_id` )
193209);
194210
211+ DROP TABLE IF EXISTS ` commentreports` ;
195212CREATE TABLE `commentreports ` (
196213 ` report_id` int (11 ) NOT NULL auto_increment,
197214 ` comment_id` int (11 ) default NULL ,
@@ -209,6 +226,7 @@ CREATE TABLE `commentreports` (
209226 PRIMARY KEY (` report_id` )
210227);
211228
229+ DROP TABLE IF EXISTS ` comments` ;
212230CREATE TABLE `comments ` (
213231 ` comment_id` int (11 ) NOT NULL auto_increment,
214232 ` user_id` int (11 ) NOT NULL default ' 0' ,
@@ -224,6 +242,7 @@ CREATE TABLE `comments` (
224242 KEY ` visible` (` visible` )
225243);
226244
245+ DROP TABLE IF EXISTS ` editqueue` ;
227246CREATE TABLE `editqueue ` (
228247 ` edit_id` int (11 ) NOT NULL auto_increment,
229248 ` user_id` int (11 ) default NULL ,
@@ -245,6 +264,7 @@ CREATE TABLE `editqueue` (
245264 KEY ` glossary_id` (` glossary_id` )
246265);
247266
267+ DROP TABLE IF EXISTS ` glossary` ;
248268CREATE TABLE `glossary ` (
249269 ` glossary_id` int (11 ) NOT NULL auto_increment,
250270 ` title` varchar (255 ) default NULL ,
@@ -258,6 +278,7 @@ CREATE TABLE `glossary` (
258278 KEY ` visible` (` visible` )
259279);
260280
281+ DROP TABLE IF EXISTS ` search_query_log` ;
261282CREATE TABLE `search_query_log ` (
262283 ` id` int (11 ) NOT NULL auto_increment,
263284 ` query_string` text ,
@@ -269,6 +290,7 @@ CREATE TABLE `search_query_log` (
269290 KEY ` query_time` (` query_time` )
270291);
271292
293+ DROP TABLE IF EXISTS ` trackbacks` ;
272294CREATE TABLE `trackbacks ` (
273295 ` trackback_id` int (11 ) NOT NULL auto_increment,
274296 ` epobject_id` int (11 ) default NULL ,
@@ -283,14 +305,15 @@ CREATE TABLE `trackbacks` (
283305 KEY ` visible` (` visible` )
284306);
285307
308+ DROP TABLE IF EXISTS ` users` ;
286309CREATE TABLE `users ` (
287310 ` user_id` mediumint(9 ) NOT NULL auto_increment,
288311 ` firstname` varchar (255 ) NOT NULL default ' ' ,
289312 ` lastname` varchar (255 ) NOT NULL default ' ' ,
290313 ` email` varchar (255 ) NOT NULL default ' ' ,
291314 ` password` varchar (102 ) NOT NULL default ' ' ,
292- ` lastvisit` datetime NOT NULL default ' 0000-00-00 00:00:00' ,
293- ` registrationtime` datetime NOT NULL default ' 0000-00-00 00:00:00' ,
315+ ` lastvisit` datetime NOT NULL default ' 0000-01-01 00:00:00' ,
316+ ` registrationtime` datetime NOT NULL default ' 0000-01-01 00:00:00' ,
294317 ` registrationip` varchar (20 ) default NULL ,
295318 ` status` enum(' Viewer' ,' User' ,' Moderator' ,' Administrator' ,' Superuser' ) default ' Viewer' ,
296319 ` emailpublic` tinyint (1 ) NOT NULL default ' 0' ,
@@ -306,13 +329,15 @@ CREATE TABLE `users` (
306329 KEY ` email` (` email` )
307330);
308331
332+ DROP TABLE IF EXISTS ` uservotes` ;
309333CREATE TABLE `uservotes ` (
310334 ` user_id` int (10 ) unsigned NOT NULL default ' 0' ,
311335 ` epobject_id` int (11 ) NOT NULL default ' 0' ,
312336 ` vote` tinyint (1 ) NOT NULL default ' 0' ,
313337 KEY ` epobject_id` (` epobject_id` ,` vote` )
314338);
315339
340+ DROP TABLE IF EXISTS ` mentions` ;
316341CREATE TABLE `mentions ` (
317342 ` mention_id` int (11 ) NOT NULL auto_increment,
318343 ` gid` varchar (100 ) default NULL ,
@@ -325,6 +350,7 @@ CREATE TABLE `mentions` (
325350);
326351
327352-- Free Our Bills
353+ DROP TABLE IF EXISTS ` campaigners` ;
328354CREATE TABLE `campaigners ` (
329355 ` campaigner_id` mediumint(8 ) unsigned NOT NULL auto_increment,
330356 ` email` varchar (255 ) NOT NULL default ' ' ,
@@ -340,13 +366,15 @@ CREATE TABLE `campaigners` (
340366);
341367
342368-- who each email has been sent to so far
369+ DROP TABLE IF EXISTS ` campaigners_sent_email` ;
343370CREATE TABLE `campaigners_sent_email ` (
344371 ` campaigner_id` int (11 ) NOT NULL ,
345372 ` email_name` varchar (100 ) NOT NULL ,
346373
347374 UNIQUE KEY ` campaigner_id` (` campaigner_id` ,` email_name` )
348375);
349376
377+ DROP TABLE IF EXISTS ` video_timestamps` ;
350378CREATE TABLE `video_timestamps ` (
351379 ` id` int (11 ) NOT NULL auto_increment,
352380 ` gid` varchar (100 ) NOT NULL ,
@@ -361,6 +389,7 @@ CREATE TABLE `video_timestamps` (
361389 UNIQUE KEY ` gid_user_id` (` gid` , ` user_id` )
362390);
363391
392+ DROP TABLE IF EXISTS ` api_key` ;
364393CREATE TABLE `api_key ` (
365394 ` id` int (11 ) NOT NULL auto_increment,
366395 ` user_id` mediumint(9 ) NOT NULL ,
@@ -373,6 +402,7 @@ CREATE TABLE `api_key` (
373402 KEY ` api_key` (` api_key` )
374403);
375404
405+ DROP TABLE IF EXISTS ` api_stats` ;
376406CREATE TABLE `api_stats ` (
377407 ` id` int (11 ) NOT NULL auto_increment,
378408 ` api_key` char (24 ) NOT NULL ,
@@ -382,4 +412,3 @@ CREATE TABLE `api_stats` (
382412 PRIMARY KEY (` id` ),
383413 KEY ` api_key` (` api_key` )
384414);
385-
0 commit comments