* Delete `users`.`admin`, use `things` for it instead
[specialops2.git] / res / structure.sql
blob81b7b502d3dbfef864496919e384be29f0acd900
1 -- phpMyAdmin SQL Dump
2 -- version 2.8.0.2
3 -- http://www.phpmyadmin.net
4 -- 
5 -- Host: localhost
6 -- Generation Time: Mar 22, 2006 at 09:39 PM
7 -- Server version: 5.0.19
8 -- PHP Version: 5.1.2-gentoo
10 SET AUTOCOMMIT=0;
11 START TRANSACTION;
13 -- 
14 -- Database: `so2-dev`
15 -- 
17 -- --------------------------------------------------------
19 -- 
20 -- Table structure for table `board-groups`
21 -- 
23 CREATE TABLE `board-groups` (
24   `groupid` tinyint(3) unsigned NOT NULL auto_increment,
25   `group_name` varchar(50) character set latin1 NOT NULL,
26   PRIMARY KEY  (`groupid`)
27 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
29 -- --------------------------------------------------------
31 -- 
32 -- Table structure for table `boards`
33 -- 
35 CREATE TABLE `boards` (
36   `boardid` tinyint(4) NOT NULL auto_increment,
37   `groupid` tinyint(3) unsigned NOT NULL default '0',
38   `board_name` varchar(255) NOT NULL,
39   `caption` varchar(255) NOT NULL,
40   `post_restrict` enum('none','admin-topics','admin') NOT NULL default 'none',
41   `view_restrict` enum('none','authuser','admin') NOT NULL default 'none',
42   PRIMARY KEY  (`boardid`),
43   KEY `groupid` (`groupid`)
44 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
46 -- --------------------------------------------------------
48 -- 
49 -- Table structure for table `marks`
50 -- 
52 CREATE TABLE `marks` (
53   `messageid` mediumint(8) unsigned NOT NULL default '0',
54   `userid` smallint(5) unsigned NOT NULL,
55   `change` tinyint(4) NOT NULL,
56   `time` int(10) unsigned NOT NULL,
57   PRIMARY KEY  (`messageid`,`userid`)
58 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
60 -- --------------------------------------------------------
62 -- 
63 -- Table structure for table `message-data`
64 -- 
66 CREATE TABLE `message-data` (
67   `messageid` mediumint(8) unsigned NOT NULL default '0',
68   `mtext` text NOT NULL,
69   PRIMARY KEY  (`messageid`)
70 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
72 -- --------------------------------------------------------
74 -- 
75 -- Table structure for table `messages`
76 -- 
78 CREATE TABLE `messages` (
79   `messageid` mediumint(8) unsigned NOT NULL auto_increment,
80   `topicid` mediumint(8) unsigned NOT NULL default '0',
81   `userid` smallint(5) unsigned NOT NULL default '0',
82   `mtime` int(10) unsigned NOT NULL,
83   `score` smallint(6) NOT NULL default '0',
84   `marks` smallint(5) unsigned NOT NULL default '0',
85   `replyto` mediumint(8) unsigned default NULL,
86   `origin_ip` int(10) unsigned NOT NULL,
87   PRIMARY KEY  (`messageid`),
88   KEY `topicid` (`topicid`),
89   KEY `userid` (`userid`),
90   KEY `replyto` (`replyto`)
91 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
93 -- --------------------------------------------------------
95 -- 
96 -- Table structure for table `themes`
97 -- 
99 CREATE TABLE `themes` (
100   `themeid` tinyint(3) unsigned NOT NULL auto_increment,
101   `theme_name` char(20) NOT NULL,
102   `css_file` char(20) NOT NULL,
103   PRIMARY KEY  (`themeid`)
104 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 ROW_FORMAT=FIXED;
106 -- --------------------------------------------------------
108 -- 
109 -- Table structure for table `things`
110 -- 
112 CREATE TABLE `things` (
113   `id` smallint(5) unsigned NOT NULL auto_increment,
114   `userid` smallint(5) unsigned NOT NULL,
115   `what` enum('invite','admin') NOT NULL,
116   `data` varchar(36) default NULL,
117   PRIMARY KEY  (`id`),
118   KEY `userid` (`userid`),
119   KEY `item` (`what`)
120 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
122 -- --------------------------------------------------------
124 -- 
125 -- Table structure for table `topics`
126 -- 
128 CREATE TABLE `topics` (
129   `topicid` mediumint(8) unsigned NOT NULL auto_increment,
130   `topic_title` varchar(255) NOT NULL,
131   `userid` smallint(5) unsigned NOT NULL default '0',
132   `boardid` tinyint(4) NOT NULL default '0',
133   `visibility` enum('normal','sticky','deleted') NOT NULL default 'normal',
134   `closed` tinyint(1) NOT NULL default '0',
135   `lastpost` mediumint(8) unsigned default NULL,
136   PRIMARY KEY  (`topicid`),
137   KEY `lastpost` (`lastpost`),
138   KEY `boardid` (`boardid`),
139   KEY `userid` (`userid`)
140 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
142 -- --------------------------------------------------------
144 -- 
145 -- Table structure for table `users`
146 -- 
148 CREATE TABLE `users` (
149   `userid` smallint(5) unsigned NOT NULL auto_increment,
150   `alias` varchar(25) NOT NULL,
151   `password` tinyblob,
152   `points` int(10) unsigned NOT NULL default '0',
153   `invites` tinyint(3) unsigned NOT NULL default '0',
154   `referrer` smallint(5) unsigned default NULL,
155   `options` set('namelinks','alwaysonline','javascript') NOT NULL default 'alwaysonline',
156   `boardlist_layout` tinyint(1) unsigned NOT NULL default '0',
157   `topiclist_layout` tinyint(1) unsigned NOT NULL default '0',
158   `msglist_layout` tinyint(1) unsigned NOT NULL default '0',
159   `msglist_style` tinyint(1) unsigned NOT NULL default '0',
160   `topics_page` tinyint(3) unsigned NOT NULL default '35',
161   `msgs_page` tinyint(3) unsigned NOT NULL default '35',
162   `timezone` tinyint(2) NOT NULL default '0',
163   `theme` tinyint(3) unsigned NOT NULL default '4',
164   `last_active_date` int(10) unsigned NOT NULL,
165   `register_date` int(10) unsigned NOT NULL,
166   `sig` varchar(255) default NULL,
167   `quote` varchar(255) default NULL,
168   `useragent` varchar(160) default NULL,
169   `public_email` varchar(70) default NULL,
170   `private_email` varchar(70) default NULL,
171   `reg_email` varchar(70) NOT NULL,
172   `last_ip` int(10) unsigned default '0',
173   `last_login_ip` int(10) unsigned default '0',
174   `reg_ip` int(10) unsigned default '0',
175   `date_format` varchar(40) NOT NULL default 'Y-m-d H:i:s',
176   `comment_threshold` tinyint(1) NOT NULL default '0',
177   PRIMARY KEY  (`userid`),
178   KEY `u_referrer` (`referrer`),
179   KEY `alias` (`alias`),
180   KEY `last_active_date` (`last_active_date`)
181 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
183 -- 
184 -- Constraints for dumped tables
185 -- 
187 -- 
188 -- Constraints for table `message-data`
189 -- 
190 ALTER TABLE `message-data`
191   ADD CONSTRAINT `message-data_ibfk_1` FOREIGN KEY (`messageid`) REFERENCES `messages` (`messageid`) ON DELETE CASCADE;
193 -- 
194 -- Constraints for table `messages`
195 -- 
196 ALTER TABLE `messages`
197   ADD CONSTRAINT `messages_ibfk_7` FOREIGN KEY (`topicid`) REFERENCES `topics` (`topicid`) ON DELETE CASCADE,
198   ADD CONSTRAINT `messages_ibfk_8` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE,
199   ADD CONSTRAINT `messages_ibfk_9` FOREIGN KEY (`replyto`) REFERENCES `messages` (`messageid`) ON DELETE CASCADE;
201 -- 
202 -- Constraints for table `things`
203 -- 
204 ALTER TABLE `things`
205   ADD CONSTRAINT `things_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
207 -- 
208 -- Constraints for table `topics`
209 -- 
210 ALTER TABLE `topics`
211   ADD CONSTRAINT `topics_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE,
212   ADD CONSTRAINT `topics_ibfk_2` FOREIGN KEY (`lastpost`) REFERENCES `messages` (`messageid`) ON DELETE CASCADE;
214 -- 
215 -- Constraints for table `users`
216 -- 
217 ALTER TABLE `users`
218   ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`referrer`) REFERENCES `users` (`userid`) ON DELETE CASCADE;
220 COMMIT;