-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrasig0226.sql
188 lines (154 loc) · 6.64 KB
/
trasig0226.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
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Värd: 127.0.0.1
-- Tid vid skapande: 26 feb 2015 kl 00:49
-- Serverversion: 5.6.17
-- PHP-version: 5.5.12
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 */;
--
-- Databas: `trasig`
--
-- --------------------------------------------------------
--
-- Tabellstruktur `categories`
--
CREATE TABLE IF NOT EXISTS `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) CHARACTER SET latin1 NOT NULL,
`fullName` varchar(30) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci AUTO_INCREMENT=5 ;
--
-- Dumpning av Data i tabell `categories`
--
INSERT INTO `categories` (`id`, `name`, `fullName`) VALUES
(1, 'all', 'Allt'),
(2, 'data', 'Data och IT'),
(3, 'trams', 'Trams'),
(4, 'ovrigt', 'Övrigt'),
(5, 'fritid', 'Sport och fritid');
-- --------------------------------------------------------
--
-- Tabellstruktur `comments`
--
CREATE TABLE IF NOT EXISTS `comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`post_id` int(11) NOT NULL,
`parent_id` int(11) NOT NULL,
`comment_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`content` varchar(2000) NOT NULL,
`edited_date` timestamp NOT NULL,
PRIMARY KEY (`id`),
KEY `comment_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
--
-- Dumpning av Data i tabell `comments`
--
INSERT INTO `comments` (`id`, `user_id`, `post_id`, `parent_id`, `comment_date`, `content`, `edited_date`) VALUES
(9, 4, 2, 0, '2015-02-25 16:06:37', 'tydligen ska man behöva kommentera', '0000-00-00 00:00:00'),
(10, 4, 2, 0, '2015-02-25 16:06:46', 'blablalbalskbaspajs japsjf askasjsfpaäåjpasoj pajsfaposjfaäp jaäo jäpajsäfpajfpas', '0000-00-00 00:00:00'),
(11, 4, 7, 0, '2015-02-25 21:19:56', 'ojojoj kommentar', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellstruktur `posts`
--
CREATE TABLE IF NOT EXISTS `posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`link` varchar(255) NOT NULL,
`content` varchar(2000) NOT NULL,
`post_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`nsfw` tinyint(1) DEFAULT '0',
`user_id` int(11) NOT NULL,
`cat_id` int(11) NOT NULL,
`edited_date` timestamp NOT NULL,
`deleted` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `posts_user` (`user_id`),
KEY `posts_category` (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
--
-- Dumpning av Data i tabell `posts`
--
INSERT INTO `posts` (`id`, `title`, `link`, `content`, `post_date`, `nsfw`, `user_id`, `cat_id`, `edited_date`, `deleted`) VALUES
(2, 'hasfhaä', 'äaskfäpaok', 'äaoskfäpa', '2014-12-15 23:47:33', 0, 4, 1, '0000-00-00 00:00:00', 0),
(4, 'Google asså!', 'http://www.google.se', 'ojoj den här sidan är asbra!', '2015-01-09 15:57:53', 1, 6, 1, '0000-00-00 00:00:00', 0),
(5, 'HEJEHEJEHJ', 'http://hej.se', 'HEJHEJ DET HÄR ÄR MITT FJÄRDE MEDDELANDE OJOJOJ PUSSPUSS!', '2015-01-09 17:55:51', 0, 7, 1, '0000-00-00 00:00:00', 0),
(6, 'google igen?', 'http://google.se', 'här är google igen. Testar dupecheck', '2015-01-14 23:28:41', 0, 4, 1, '0000-00-00 00:00:00', 0),
(7, 'google', 'http://google.com', 'google test', '2015-01-14 23:30:30', 0, 4, 1, '2015-02-25 21:30:23', 1),
(8, 'OJoj testar en länk i data och it!', 'http://www.reddit.com/r/webdev', 'värsta grejen va!', '2015-01-19 20:15:53', 0, 4, 2, '0000-00-00 00:00:00', 0);
-- --------------------------------------------------------
--
-- Tabellstruktur `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(70) NOT NULL,
`account_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`profilePicture` varchar(30) NOT NULL DEFAULT 'profile.png',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
--
-- Dumpning av Data i tabell `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `email`, `account_date`, `profilePicture`) VALUES
(4, 'hej', '$2y$10$uA/myiHpic5rCrH94ecHV.FIV5PL25/w4t1obkfhMBAQBGVFtjpmK', 'hej', '2014-12-11 15:08:20', 'mhslu34468.png'),
(5, 'admin', '$2y$10$rVHs/AcfVVKCPw0FLAEd0e3G4cycr3BV3wPXlfj/B/JRvPvvVeZ9a', '[email protected]', '2014-12-11 17:21:33', 'profile.png'),
(6, 'ojoj', '$2y$10$dvn7faw/8urRnYYsNrSAuuF2tZRBrMqeN5TulOtqTNk52qBQ4ecV2', '[email protected]', '2015-01-09 15:57:02', 'profile.png'),
(7, 'splurgen', '$2y$10$dhf3TmLgWY4iuKrcA5caretfUyFOk28s4FByvHX7gTVGDVVdu9nNy', '[email protected]', '2015-01-09 17:52:58', 'profile.png'),
(9, 'hejsan', '$2y$10$dPRhR3ZN8nmwnz//4W3ziOeuq9zo6xGWWBEk/PJoOMOU7Ez.IkqBS', '[email protected]', '2015-01-15 14:18:37', 'profile.png');
-- --------------------------------------------------------
--
-- Tabellstruktur `votes`
--
CREATE TABLE IF NOT EXISTS `votes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`value` tinyint(1) NOT NULL,
`post_id` int(11) NOT NULL,
`vote_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `vote_user` (`user_id`),
KEY `vote_post` (`post_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;
--
-- Dumpning av Data i tabell `votes`
--
INSERT INTO `votes` (`id`, `user_id`, `value`, `post_id`, `vote_date`) VALUES
(20, 4, 1, 4, '2015-02-25 21:19:37'),
(21, 4, 1, 7, '2015-02-25 21:19:52'),
(22, 4, -1, 5, '2015-02-25 23:25:29');
--
-- Restriktioner för dumpade tabeller
--
--
-- Restriktioner för tabell `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
--
-- Restriktioner för tabell `posts`
--
ALTER TABLE `posts`
ADD CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`cat_id`) REFERENCES `categories` (`id`);
--
-- Restriktioner för tabell `votes`
--
ALTER TABLE `votes`
ADD CONSTRAINT `votes_ibfk_2` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
ADD CONSTRAINT `votes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
/*!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 */;