(making it readable would be a good idea...)
[specialops2.git] / res / structure.sql
blob5ecebf4721c95b4196a43c99257eec9f52514eaa
1 -- phpMyAdmin SQL Dump
2 -- version 2.8.0.3
3 -- http://www.phpmyadmin.net
4 -- 
5 -- Host: localhost
6 -- Generation Time: May 08, 2006 at 06:37 PM
7 -- Server version: 5.0.19
8 -- PHP Version: 5.1.4-pl0-gentoo
9 -- 
10 -- Database: `so2-dev`
11 -- 
13 -- --------------------------------------------------------
15 -- 
16 -- Table structure for table `board-groups`
17 -- 
19 CREATE TABLE `board-groups` (
20   `groupid` tinyint(3) unsigned NOT NULL auto_increment,
21   `group_name` varchar(50) character set latin1 NOT NULL,
22   `hidden` tinyint(1) NOT NULL default '0',
23   PRIMARY KEY  (`groupid`)
24 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
26 -- --------------------------------------------------------
28 -- 
29 -- Table structure for table `boards`
30 -- 
32 CREATE TABLE `boards` (
33   `boardid` smallint(6) NOT NULL auto_increment,
34   `groupid` tinyint(3) unsigned NOT NULL default '0',
35   `board_name` varchar(255) NOT NULL,
36   `caption` varchar(255) NOT NULL,
37   `post_restrict` enum('none','admin-topics','admin') NOT NULL default 'none',
38   `view_restrict` enum('none','authuser','admin') NOT NULL default 'none',
39   PRIMARY KEY  (`boardid`),
40   KEY `groupid` (`groupid`)
41 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
43 -- --------------------------------------------------------
45 -- 
46 -- Table structure for table `marks`
47 -- 
49 CREATE TABLE `marks` (
50   `messageid` mediumint(8) unsigned NOT NULL default '0',
51   `userid` smallint(5) unsigned NOT NULL,
52   `change` tinyint(4) NOT NULL,
53   `time` int(10) unsigned NOT NULL,
54   PRIMARY KEY  (`messageid`,`userid`)
55 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
57 -- --------------------------------------------------------
59 -- 
60 -- Table structure for table `message-data`
61 -- 
63 CREATE TABLE `message-data` (
64   `messageid` mediumint(8) unsigned NOT NULL default '0',
65   `mtext` text NOT NULL,
66   PRIMARY KEY  (`messageid`)
67 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
69 -- --------------------------------------------------------
71 -- 
72 -- Table structure for table `messages`
73 -- 
75 CREATE TABLE `messages` (
76   `messageid` mediumint(8) unsigned NOT NULL auto_increment,
77   `topicid` mediumint(8) unsigned NOT NULL default '0',
78   `userid` smallint(5) unsigned NOT NULL default '0',
79   `mtime` int(10) unsigned NOT NULL,
80   `score` smallint(6) NOT NULL default '0',
81   `marks` smallint(5) unsigned NOT NULL default '0',
82   `replyto` mediumint(8) unsigned default NULL,
83   `origin_ip` int(10) unsigned NOT NULL,
84   PRIMARY KEY  (`messageid`),
85   KEY `topicid` (`topicid`),
86   KEY `userid` (`userid`),
87   KEY `replyto` (`replyto`)
88 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
90 -- --------------------------------------------------------
92 -- 
93 -- Table structure for table `themes`
94 -- 
96 CREATE TABLE `themes` (
97   `themeid` tinyint(3) unsigned NOT NULL auto_increment,
98   `theme_name` char(20) NOT NULL,
99   `css_file` char(20) NOT NULL,
100   PRIMARY KEY  (`themeid`)
101 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 ROW_FORMAT=FIXED;
103 -- --------------------------------------------------------
105 -- 
106 -- Table structure for table `things`
107 -- 
109 CREATE TABLE `things` (
110   `id` smallint(5) unsigned NOT NULL auto_increment,
111   `userid` smallint(5) unsigned NOT NULL,
112   `what` enum('invite','admin') NOT NULL,
113   `data` varchar(36) default NULL,
114   PRIMARY KEY  (`id`),
115   KEY `userid` (`userid`),
116   KEY `item` (`what`)
117 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
119 -- --------------------------------------------------------
121 -- 
122 -- Table structure for table `topics`
123 -- 
125 CREATE TABLE `topics` (
126   `topicid` mediumint(8) unsigned NOT NULL auto_increment,
127   `topic_title` varchar(255) NOT NULL,
128   `userid` smallint(5) unsigned NOT NULL default '0',
129   `boardid` smallint(6) NOT NULL default '0',
130   `visibility` enum('normal','sticky','deleted') NOT NULL default 'normal',
131   `closed` tinyint(1) NOT NULL default '0',
132   `lastpost` mediumint(8) unsigned default NULL,
133   PRIMARY KEY  (`topicid`),
134   KEY `lastpost` (`lastpost`),
135   KEY `boardid` (`boardid`),
136   KEY `userid` (`userid`)
137 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
139 -- --------------------------------------------------------
141 -- 
142 -- Table structure for table `users`
143 -- 
145 CREATE TABLE `users` (
146   `userid` smallint(5) unsigned NOT NULL auto_increment,
147   `alias` varchar(25) NOT NULL,
148   `password` tinyblob,
149   `points` int(10) unsigned NOT NULL default '0',
150   `invites` tinyint(3) unsigned NOT NULL default '0',
151   `referrer` smallint(5) unsigned default NULL,
152   `options` set('namelinks','alwaysonline','javascript','cache','quickpost') NOT NULL default 'alwaysonline',
153   `boardlist_layout` tinyint(1) unsigned NOT NULL default '0',
154   `topiclist_layout` tinyint(1) unsigned NOT NULL default '0',
155   `msglist_layout` tinyint(1) unsigned NOT NULL default '0',
156   `msglist_style` tinyint(1) unsigned NOT NULL default '0',
157   `topics_page` tinyint(3) unsigned NOT NULL default '35',
158   `msgs_page` tinyint(3) unsigned NOT NULL default '35',
159   `timezone` tinyint(2) NOT NULL default '0',
160   `theme` tinyint(3) unsigned NOT NULL default '4',
161   `last_active_date` int(10) unsigned NOT NULL,
162   `register_date` int(10) unsigned NOT NULL,
163   `sig` varchar(255) default NULL,
164   `quote` varchar(255) default NULL,
165   `useragent` varchar(160) default NULL,
166   `public_contact` varchar(100) default NULL,
167   `private_contact` varchar(100) default NULL,
168   `reg_contact` varchar(100) NOT NULL,
169   `last_ip` int(10) unsigned default '0',
170   `last_login_ip` int(10) unsigned default '0',
171   `reg_ip` int(10) unsigned default '0',
172   `date_format` varchar(40) NOT NULL default 'Y-m-d H:i:s',
173   PRIMARY KEY  (`userid`),
174   KEY `u_referrer` (`referrer`),
175   KEY `alias` (`alias`),
176   KEY `last_active_date` (`last_active_date`)
177 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
179 -- 
180 -- Constraints for dumped tables
181 -- 
183 -- 
184 -- Constraints for table `message-data`
185 -- 
186 ALTER TABLE `message-data`
187   ADD CONSTRAINT `message-data_ibfk_1` FOREIGN KEY (`messageid`) REFERENCES `messages` (`messageid`) ON DELETE CASCADE;
189 -- 
190 -- Constraints for table `messages`
191 -- 
192 ALTER TABLE `messages`
193   ADD CONSTRAINT `messages_ibfk_7` FOREIGN KEY (`topicid`) REFERENCES `topics` (`topicid`) ON DELETE CASCADE,
194   ADD CONSTRAINT `messages_ibfk_8` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE,
195   ADD CONSTRAINT `messages_ibfk_9` FOREIGN KEY (`replyto`) REFERENCES `messages` (`messageid`) ON DELETE CASCADE;
197 -- 
198 -- Constraints for table `things`
199 -- 
200 ALTER TABLE `things`
201   ADD CONSTRAINT `things_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
203 -- 
204 -- Constraints for table `topics`
205 -- 
206 ALTER TABLE `topics`
207   ADD CONSTRAINT `topics_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE,
208   ADD CONSTRAINT `topics_ibfk_2` FOREIGN KEY (`lastpost`) REFERENCES `messages` (`messageid`) ON DELETE CASCADE;
210 -- 
211 -- Constraints for table `users`
212 -- 
213 ALTER TABLE `users`
214   ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`referrer`) REFERENCES `users` (`userid`) ON DELETE CASCADE;