-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcuriousw_db.sql
202 lines (173 loc) · 6.81 KB
/
curiousw_db.sql
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
-- phpMyAdmin SQL Dump
-- version 3.4.10.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 13, 2013 at 08:35 AM
-- Server version: 5.5.20
-- PHP Version: 5.3.10
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `curiousw_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `follow`
--
CREATE TABLE IF NOT EXISTS `follow` (
`follow_a` int(10) unsigned NOT NULL,
`follow_b` int(10) unsigned NOT NULL,
PRIMARY KEY (`follow_a`,`follow_b`),
KEY `follow_a` (`follow_a`),
KEY `follow_b` (`follow_b`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `list2top`
--
CREATE TABLE IF NOT EXISTS `list2top` (
`id_topic` int(10) unsigned NOT NULL,
`id_list` int(10) unsigned NOT NULL,
`id_by` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_topic`,`id_list`,`id_by`),
KEY `id_topic` (`id_topic`),
KEY `id_list` (`id_list`),
KEY `id_by` (`id_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `lists`
--
CREATE TABLE IF NOT EXISTS `lists` (
`list_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`list_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`list_by` int(10) unsigned NOT NULL,
`list_date` datetime NOT NULL,
`list_cnt` int(10) unsigned NOT NULL,
PRIMARY KEY (`list_id`),
KEY `list_cnt` (`list_cnt`),
KEY `list_date` (`list_date`),
KEY `list_by` (`list_by`),
KEY `list_name` (`list_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=30 ;
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE IF NOT EXISTS `posts` (
`post_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`post_text` text COLLATE utf8_unicode_ci NOT NULL,
`post_date` datetime NOT NULL,
`post_topic` int(10) unsigned DEFAULT NULL,
`post_root` int(11) DEFAULT NULL,
`post_by` int(10) unsigned NOT NULL,
`post_special` int(10) unsigned NOT NULL,
`post_edit` datetime NOT NULL,
`post_ip` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`post_id`),
KEY `post_topic` (`post_topic`),
KEY `post_date` (`post_date`),
KEY `post_by` (`post_by`),
KEY `post_root` (`post_root`),
KEY `post_edit` (`post_edit`),
KEY `post_special` (`post_special`),
KEY `post_ip` (`post_ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6937 ;
-- --------------------------------------------------------
--
-- Table structure for table `topics`
--
CREATE TABLE IF NOT EXISTS `topics` (
`topic_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`topic_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`topic_root` int(10) unsigned NOT NULL,
`topic_date` datetime NOT NULL,
`topic_by` int(10) unsigned NOT NULL,
`topic_replies` int(10) unsigned NOT NULL,
`topic_score` double NOT NULL,
`topic_special` int(10) unsigned NOT NULL,
`topic_class` int(10) unsigned NOT NULL,
PRIMARY KEY (`topic_id`),
KEY `topic_date` (`topic_date`),
KEY `topic_by` (`topic_by`),
KEY `topic_score` (`topic_score`),
KEY `topic_root` (`topic_root`),
KEY `topic_replies` (`topic_replies`),
KEY `topic_special` (`topic_special`),
KEY `topic_title` (`topic_title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1746 ;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`user_pass` binary(20) NOT NULL,
`user_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`user_date` datetime NOT NULL,
`user_ip` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`user_level` int(10) NOT NULL,
`user_posts` int(10) unsigned NOT NULL,
`user_signin` datetime NOT NULL,
`user_lastpost` datetime NOT NULL,
`user_following` int(10) unsigned NOT NULL,
`user_followers` int(10) unsigned NOT NULL,
`user_css` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`user_hidposts` int(10) unsigned NOT NULL,
`user_location` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`user_education` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`user_major` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`user_hobby` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_name` (`user_name`),
KEY `user_signin` (`user_signin`),
KEY `user_date` (`user_date`),
KEY `user_posts` (`user_posts`),
KEY `user_lastpost` (`user_lastpost`),
KEY `user_following` (`user_following`),
KEY `user_followers` (`user_followers`),
KEY `user_email` (`user_email`),
KEY `user_level` (`user_level`),
KEY `user_hidposts` (`user_hidposts`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1095 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `follow`
--
ALTER TABLE `follow`
ADD CONSTRAINT `follow_ibfk_1` FOREIGN KEY (`follow_a`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `follow_ibfk_2` FOREIGN KEY (`follow_b`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `list2top`
--
ALTER TABLE `list2top`
ADD CONSTRAINT `list2top_ibfk_1` FOREIGN KEY (`id_topic`) REFERENCES `topics` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `list2top_ibfk_2` FOREIGN KEY (`id_list`) REFERENCES `lists` (`list_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `lists`
--
ALTER TABLE `lists`
ADD CONSTRAINT `lists_ibfk_1` FOREIGN KEY (`list_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `posts`
--
ALTER TABLE `posts`
ADD CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`post_topic`) REFERENCES `topics` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `posts_ibfk_3` FOREIGN KEY (`post_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `topics`
--
ALTER TABLE `topics`
ADD CONSTRAINT `topics_ibfk_2` FOREIGN KEY (`topic_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `topics_ibfk_3` FOREIGN KEY (`topic_root`) REFERENCES `posts` (`post_id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;