aboutsummaryrefslogtreecommitdiff
path: root/tables.sql
blob: 0085b42463ecb8bc4cd2ba0d6a4662014dc23a14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
-- h-source, a web software to build a community of people that want to share their hardware information.
-- Copyright (C) 2010  Antonio Gallo (h-source-copyright.txt)
--
-- This file is part of h-source
--
-- h-source is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- h-source is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with h-source.  If not, see <http://www.gnu.org/licenses/>.


SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


-- --------------------------------------------------------

--
-- Table structure for table `accesses`
--

CREATE TABLE IF NOT EXISTS `accesses` (
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `ip` char(20) NOT NULL,
  `data` char(10) NOT NULL,
  `ora` char(8) NOT NULL,
  `username` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `admingroups`
--

CREATE TABLE IF NOT EXISTS `admingroups` (
  `id_group` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`id_group`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `adminsessions`
--

CREATE TABLE IF NOT EXISTS `adminsessions` (
  `uid` char(32) NOT NULL,
  `token` char(32) NOT NULL,
  `id_user` int(10) unsigned NOT NULL,
  `creation_date` int(10) unsigned NOT NULL,
  `user_agent` char(32) NOT NULL,
  KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `adminusers`
--

CREATE TABLE IF NOT EXISTS `adminusers` (
  `id_user` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(80) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `password` char(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `last_failure` int(10) unsigned NOT NULL,
  `has_confirmed` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id_user`),
  UNIQUE KEY `username` (`username`),
  KEY `username_2` (`username`,`password`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `adminusers_groups`
--

CREATE TABLE IF NOT EXISTS `adminusers_groups` (
  `id_user` int(11) unsigned NOT NULL,
  `id_group` int(11) unsigned NOT NULL,
  UNIQUE KEY `id_group` (`id_group`,`id_user`),
  KEY `group_indx` (`id_group`),
  KEY `user_indx` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `boxes`
--

CREATE TABLE IF NOT EXISTS `boxes` (
  `id_box` int(11) NOT NULL AUTO_INCREMENT,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `title` varchar(150) NOT NULL,
  `message` text NOT NULL,
  PRIMARY KEY (`id_box`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `deletion`
--

CREATE TABLE IF NOT EXISTS `deletion` (
  `id_del` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `object` char(15) NOT NULL,
  `message` text NOT NULL,
  `id_hard` int(10) unsigned NOT NULL,
  `id_duplicate` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id_del`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `hardware`
--

CREATE TABLE IF NOT EXISTS `hardware` (
  `id_hard` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(50) NOT NULL,
  `kernel` varchar(100) NOT NULL,
  `vendor` varchar(50) NOT NULL,
  `model` varchar(200) NOT NULL,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_date` datetime NOT NULL,
  `compatibility` char(15) NOT NULL,
  `description` text NOT NULL,
  `distribution` varchar(300) NOT NULL,
  `video_card_type` varchar(100) NOT NULL,
  `video_card_works` varchar(30) NOT NULL,
  `wifi_type` varchar(100) NOT NULL,
  `wifi_works` varchar(30) NOT NULL,
  `comm_year` char(15) NOT NULL,
  `ask_for_del` char(4) NOT NULL DEFAULT 'no',
  `deleted` char(4) NOT NULL DEFAULT 'no',
  `pci_id` char(10) NOT NULL,
  `subtype` char(25) NOT NULL DEFAULT 'not-specified',
  `driver` varchar(50) NOT NULL,
  `interface` char(15) NOT NULL DEFAULT 'not-specified',
  `bios` char(20) NOT NULL DEFAULT 'not-specified',
  `webcam_type` varchar(100) NOT NULL,
  `webcam_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `sound_card_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `bluetooth_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `fingerprint_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `architecture` char(15) NOT NULL DEFAULT 'not-specified',
  `other_names` text NOT NULL,
  `approved` char(4) NOT NULL DEFAULT 'yes',
  `cleared` char(3) NOT NULL DEFAULT 'no',
  `ethernet_card_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `sd_card_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `can_free_systems_be_installed` varchar(30) NOT NULL DEFAULT 'not-specified',
  `it_tracks_users` varchar(30) NOT NULL DEFAULT 'not-specified',
  `prevent_wifi` char(20) NOT NULL DEFAULT 'not-specified',
  PRIMARY KEY (`id_hard`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `hardware_users`
--

CREATE TABLE IF NOT EXISTS `hardware_users` (
  `id_user` int(11) unsigned NOT NULL,
  `id_hard` int(11) unsigned NOT NULL,
  UNIQUE KEY `id_user` (`id_user`,`id_hard`),
  KEY `hard_indx` (`id_hard`),
  KEY `user_indx` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `history`
--

CREATE TABLE IF NOT EXISTS `history` (
  `id_history` int(11) NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `type` char(15) NOT NULL,
  `action` char(15) NOT NULL,
  `id` int(10) unsigned NOT NULL,
  `message` text NOT NULL,
  `gr` char(15) NOT NULL,
  PRIMARY KEY (`id_history`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;

-- --------------------------------------------------------

--
-- Table structure for table `issues`
--

CREATE TABLE IF NOT EXISTS `issues` (
  `id_issue` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_date` datetime NOT NULL,
  `topic` char(35) NOT NULL,
  `title` varchar(100) NOT NULL,
  `message` text NOT NULL,
  `priority` char(15) NOT NULL,
  `status` char(15) NOT NULL,
  `notice` text NOT NULL,
  `deleted` char(4) NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id_issue`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `messages`
--

CREATE TABLE IF NOT EXISTS `messages` (
  `id_mes` int(11) NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `message` text NOT NULL,
  `id_issue` int(10) unsigned NOT NULL,
  `deleted` char(4) NOT NULL DEFAULT 'no',
  `has_read` char(4) NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id_mes`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `news`
--

CREATE TABLE IF NOT EXISTS `news` (
  `id_news` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `title` varchar(150) NOT NULL,
  `message` text NOT NULL,
  PRIMARY KEY (`id_news`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `params`
--

CREATE TABLE IF NOT EXISTS `params` (
  `id_par` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `updating` char(4) NOT NULL DEFAULT 'no',
  `boxes_xml` text NOT NULL,
  PRIMARY KEY (`id_par`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;

insert into params (updating) values ('no');

-- --------------------------------------------------------

--
-- Table structure for table `profile`
--

CREATE TABLE IF NOT EXISTS `profile` (
  `id_prof` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_date` datetime NOT NULL,
  `real_name` varchar(100) NOT NULL,
  `where_you_are` varchar(100) NOT NULL,
  `birth_date` varchar(100) NOT NULL,
  `fav_distro` varchar(100) NOT NULL,
  `projects` text NOT NULL,
  `publish_mail` char(4) NOT NULL DEFAULT 'no',
  `description` text NOT NULL,
  `website` varchar(100) NOT NULL,
  `send_notification` char(4) NOT NULL DEFAULT 'yes',
  PRIMARY KEY (`id_prof`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `regaccesses`
--

CREATE TABLE IF NOT EXISTS `regaccesses` (
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `ip` char(20) NOT NULL,
  `data` char(10) NOT NULL,
  `ora` char(8) NOT NULL,
  `username` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

-- --------------------------------------------------------

--
-- Table structure for table `reggroups`
--

CREATE TABLE IF NOT EXISTS `reggroups` (
  `id_group` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`id_group`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;

-- --------------------------------------------------------

--
-- Table structure for table `regsessions`
--

CREATE TABLE IF NOT EXISTS `regsessions` (
  `uid` char(32) NOT NULL,
  `token` char(32) NOT NULL,
  `id_user` int(10) unsigned NOT NULL,
  `creation_date` int(10) unsigned NOT NULL,
  `user_agent` char(32) NOT NULL,
  KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `regusers`
--

CREATE TABLE IF NOT EXISTS `regusers` (
  `id_user` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(80) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `password` char(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `last_failure` int(10) unsigned NOT NULL,
  `has_confirmed` int(10) unsigned NOT NULL,
  `e_mail` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `confirmation_token` char(32) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `creation_time` int(10) unsigned NOT NULL,
  `temp_field` char(32) NOT NULL,
  `deleted` char(4) NOT NULL DEFAULT 'no',
  `forgot_token` char(32) NOT NULL,
  `forgot_time` int(10) unsigned NOT NULL,
  `blocked` char(4) NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id_user`),
  UNIQUE KEY `username` (`username`),
  KEY `username_2` (`username`,`password`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;

-- --------------------------------------------------------

--
-- Table structure for table `regusers_groups`
--

CREATE TABLE IF NOT EXISTS `regusers_groups` (
  `id_user` int(11) unsigned NOT NULL,
  `id_group` int(11) unsigned NOT NULL,
  UNIQUE KEY `id_group` (`id_group`,`id_user`),
  KEY `group_indx` (`id_group`),
  KEY `user_indx` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `revisions`
--

CREATE TABLE IF NOT EXISTS `revisions` (
  `id_rev` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(50) NOT NULL,
  `kernel` varchar(100) NOT NULL,
  `vendor` varchar(50) NOT NULL,
  `model` varchar(200) NOT NULL,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_date` datetime NOT NULL,
  `compatibility` char(15) NOT NULL,
  `description` text NOT NULL,
  `distribution` varchar(300) NOT NULL,
  `video_card_type` varchar(100) NOT NULL,
  `video_card_works` varchar(30) NOT NULL,
  `wifi_type` varchar(100) NOT NULL,
  `wifi_works` varchar(30) NOT NULL,
  `comm_year` char(15) NOT NULL,
  `id_hard` int(10) unsigned NOT NULL,
  `pci_id` char(10) NOT NULL,
  `subtype` char(25) NOT NULL DEFAULT 'not-specified',
  `driver` varchar(50) NOT NULL,
  `interface` char(15) NOT NULL DEFAULT 'not-specified',
  `bios` char(20) NOT NULL DEFAULT 'not-specified',
  `webcam_type` varchar(100) NOT NULL,
  `webcam_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `sound_card_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `bluetooth_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `fingerprint_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `architecture` char(15) NOT NULL DEFAULT 'not-specified',
  `other_names` text NOT NULL,
  `approved` char(4) NOT NULL DEFAULT 'yes',
  `cleared` char(3) NOT NULL DEFAULT 'no',
  `ethernet_card_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `sd_card_works` varchar(30) NOT NULL DEFAULT 'not-specified',
  `can_free_systems_be_installed` varchar(30) NOT NULL DEFAULT 'not-specified',
  `it_tracks_users` varchar(30) NOT NULL DEFAULT 'not-specified',
  `prevent_wifi` char(20) NOT NULL DEFAULT 'not-specified',
  PRIMARY KEY (`id_rev`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `talk`
--

CREATE TABLE IF NOT EXISTS `talk` (
  `id_talk` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `title` varchar(100) NOT NULL,
  `message` text NOT NULL,
  `id_hard` int(10) unsigned NOT NULL,
  `deleted` char(4) NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id_talk`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `wiki`
--

CREATE TABLE IF NOT EXISTS `wiki` (
  `id_wiki` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_date` datetime NOT NULL,
  `title` varchar(200) NOT NULL,
  `title_clean` varchar(200) NOT NULL,
  `page` text NOT NULL,
  `deleted` char(3) NOT NULL DEFAULT 'no',
  `blocked` char(3) NOT NULL DEFAULT 'no',
  `is_main` char(3) NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id_wiki`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `wiki_revisions`
--

CREATE TABLE IF NOT EXISTS `wiki_revisions` (
  `id_rev` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_date` datetime NOT NULL,
  `title` varchar(200) NOT NULL,
  `title_clean` varchar(200) NOT NULL,
  `page` text NOT NULL,
  `id_wiki` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id_rev`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `wiki_talk`
--

CREATE TABLE IF NOT EXISTS `wiki_talk` (
  `id_talk` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_by` int(11) NOT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `title` varchar(100) NOT NULL,
  `message` text NOT NULL,
  `id_wiki` int(10) unsigned NOT NULL,
  `deleted` char(4) NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id_talk`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `wiki_users`
--

CREATE TABLE IF NOT EXISTS `wiki_users` (
  `id_user` int(11) unsigned NOT NULL,
  `id_wiki` int(11) unsigned NOT NULL,
  UNIQUE KEY `id_user` (`id_user`,`id_wiki`),
  KEY `wiki_indx` (`id_wiki`),
  KEY `user_indx` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `adminusers_groups`
--
ALTER TABLE `adminusers_groups`
  ADD CONSTRAINT `adminusers_groups_ibfk_1` FOREIGN KEY (`id_group`) REFERENCES `admingroups` (`id_group`),
  ADD CONSTRAINT `adminusers_groups_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `adminusers` (`id_user`);

--
-- Constraints for table `hardware_users`
--
ALTER TABLE `hardware_users`
  ADD CONSTRAINT `hardware_users_ibfk_1` FOREIGN KEY (`id_hard`) REFERENCES `hardware` (`id_hard`),
  ADD CONSTRAINT `hardware_users_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `regusers` (`id_user`);

--
-- Constraints for table `regusers_groups`
--
ALTER TABLE `regusers_groups`
  ADD CONSTRAINT `regusers_groups_ibfk_1` FOREIGN KEY (`id_group`) REFERENCES `reggroups` (`id_group`),
  ADD CONSTRAINT `regusers_groups_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `regusers` (`id_user`);

--
-- Constraints for table `wiki_users`
--
ALTER TABLE `wiki_users`
  ADD CONSTRAINT `wiki_users_ibfk_1` FOREIGN KEY (`id_wiki`) REFERENCES `wiki` (`id_wiki`),
  ADD CONSTRAINT `wiki_users_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `regusers` (`id_user`);


create table vendors (
	id_vendor INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
	creation_date timestamp default CURRENT_TIMESTAMP,
	update_date datetime NOT NULL,
	vendorid CHAR(4) not null,
	clean_name varchar(200) CHARACTER SET utf8 not null,
	full_name varchar(200) CHARACTER SET utf8 not null,
	bus ENUM('PCI', 'USB'),
	unique(bus,vendorid)
)engine=innodb;

insert into reggroups (name) values ('manager');
insert into reggroups (name) values ('admin');
insert into reggroups (name) values ('moderator');

insert into regusers (username,password) values ('admin',sha1('admin'));

insert into regusers_groups (id_user, id_group) values (1,1);
insert into regusers_groups (id_user, id_group) values (1,2);
insert into regusers_groups (id_user, id_group) values (1,3);