-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_cms.sql
116 lines (73 loc) · 3.82 KB
/
custom_cms.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
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
CREATE TABLE `categories` (
`cat_id` int(3) NOT NULL,
`cat_title` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `categories` (`cat_id`, `cat_title`) VALUES
(2, 'Websites'),
(8, 'Games'),
(9, 'Apps');
CREATE TABLE `comments` (
`comment_id` int(3) NOT NULL,
`comment_post_id` int(3) NOT NULL,
`comment_author` varchar(255) NOT NULL,
`comment_email` varchar(255) NOT NULL,
`comment_content` text NOT NULL,
`comment_status` varchar(255) NOT NULL,
`comment_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `comments` (`comment_id`, `comment_post_id`, `comment_author`, `comment_email`, `comment_content`, `comment_status`, `comment_date`) VALUES
(11, 6, 'George Tourtsinakis', '[email protected]', 'You rock', 'unapproved', '2017-01-28'),
(12, 7, 'bee', '[email protected]', 'Your second post rocks', 'approved', '2017-02-01');
-- --------------------------------------------------------
CREATE TABLE `posts` (
`post_id` int(3) NOT NULL,
`post_category_id` int(3) NOT NULL,
`post_title` varchar(255) NOT NULL,
`post_author` varchar(255) NOT NULL,
`post_date` date NOT NULL,
`post_image` text NOT NULL,
`post_content` text NOT NULL,
`post_tags` varchar(255) NOT NULL,
`post_comment_count` int(11) NOT NULL,
`post_status` varchar(255) NOT NULL DEFAULT 'draft',
`post_cost` decimal NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `posts` (`post_id`, `post_category_id`, `post_title`, `post_author`, `post_date`, `post_image`, `post_content`, `post_tags`, `post_comment_count`, `post_status`, `post_cost`) VALUES
(6, 2, 'Hearthstone rank 9', 'George Tourtsinakis', '2017-02-02', 'Hearthstone Screenshot 01.png', '<p><strong>hearthstone, rank 9, priest</strong></p>', 'hearthstone, rank 9, priest', 1, 'published', 10),
(7, 2, 'This is another post', 'George', '2017-02-02', '', '<p>Just another post</p>', 'second post', 1, 'draft', 2),
(8, 2, 'Draft post test', 'Bee', '2017-02-02', '', '<p>draft</p>', 'draft', 0, 'draft', 4),
(9, 2, 'frogpaw', 'bogo', '2017-02-02', 'frog.jpg', '<p><strong>Frogs are very good animals and you must not eat them!!!!</strong></p>\r\n<p> </p>\r\n<p> </p>', '', 0, 'published', 9);
CREATE TABLE `users` (
`user_id` int(3) NOT NULL,
`username` varchar(255) NOT NULL,
`user_password` varchar(255) NOT NULL,
`user_first_name` varchar(20) NOT NULL,
`user_last_name` varchar(50) NOT NULL,
`user_email` varchar(255) NOT NULL,
`user_image` text NOT NULL,
`user_role` varchar(50) NOT NULL,
`randSalt` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `users` (`user_id`, `username`, `user_password`, `user_first_name`, `user_last_name`, `user_email`, `user_image`, `user_role`, `randSalt`) VALUES
(1, 'Bogo', '1234', 'George', 'Tourtsinakis', '[email protected]', '', 'admin', ''),
(2, 'bobiras', '1234', 'Bobiras', 'Mpampouras', '[email protected]', '', 'admin', ''),
(3, 'Tweety', '1234', 'Tweety', 'Tweety', '[email protected]', '', 'subscriber', ''),
(4, 'tweeta', '123456', 'tweeta', 'tweeta', '[email protected]', '', 'subscriber', '');
ALTER TABLE `categories`
ADD PRIMARY KEY (`cat_id`);
ALTER TABLE `comments`
ADD PRIMARY KEY (`comment_id`);
ALTER TABLE `posts`
ADD PRIMARY KEY (`post_id`);
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
ALTER TABLE `categories`
MODIFY `cat_id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
ALTER TABLE `comments`
MODIFY `comment_id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
ALTER TABLE `posts`
MODIFY `post_id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
ALTER TABLE `users`
MODIFY `user_id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;