xref: /web-master/note.sql (revision 690a7352)
1/* the note table holds notes for the php manual. */
2/* TODO: there is a similar table for php-gtk's manual. it should probably be
3   merged with this one. */
4/* TODO: the user stuff should be linked to the users table so people could
5   edit their own notes. */
6/* TODO: lang should probably be linked to a languages table of some sort.
7   but we're not really using it yet, so maybe we don't want it at all. */
8
9/* used by:
10   master.php.net/entry/user-note.php
11   master.php.net/entry/user-notes-vote.php
12   master.php.net/fetch/user-notes.php
13   master.php.net/manage/user-notes.php
14*/
15
16CREATE TABLE IF NOT EXISTS note (
17  id mediumint(9) NOT NULL auto_increment,
18  sect varchar(80) NOT NULL default '',
19  user varchar(80) default NULL,
20  note text,
21  ts datetime NOT NULL,
22  status varchar(16) default NULL,
23  lang varchar(16) default NULL,
24  votes int(11) NOT NULL default '0',
25  rating int(11) NOT NULL default '0',
26  updated datetime,
27  PRIMARY KEY  (id),
28  KEY idx_sect (sect)
29) ENGINE=MyISAM PACK_KEYS=1;
30
31-- New votes table added for keeping track of user notes ratings
32CREATE TABLE IF NOT EXISTS `votes` (
33  `id` int(11) NOT NULL AUTO_INCREMENT,
34  `note_id` mediumint(9) NOT NULL,
35  `ip` bigint(20) unsigned NOT NULL DEFAULT '0',
36  `hostip` bigint(20) unsigned NOT NULL DEFAULT '0',
37  `ts` datetime NOT NULL,
38  `vote` tinyint(1) unsigned NOT NULL DEFAULT '0',
39  PRIMARY KEY (`id`),
40  KEY `note_id` (`note_id`,`ip`,`vote`),
41  KEY `hostip` (`hostip`)
42) ENGINE=MyISAM AUTO_INCREMENT=1;
43