-
Notifications
You must be signed in to change notification settings - Fork 0
/
polygon_db.sql
183 lines (149 loc) · 4.89 KB
/
polygon_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
-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Oct 20, 2023 at 11:06 AM
-- Server version: 10.4.28-MariaDB
-- PHP Version: 8.2.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
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 utf8mb4 */;
--
-- Database: `polygon_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE `category` (
`id` int(11) NOT NULL,
`category` varchar(45) NOT NULL,
`slug` varchar(45) NOT NULL,
`active` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `post`
--
CREATE TABLE `post` (
`id` int(11) NOT NULL,
`title` varchar(200) NOT NULL,
`slug` varchar(200) NOT NULL,
`status` varchar(45) NOT NULL DEFAULT 'draft',
`create_date` datetime DEFAULT current_timestamp(),
`publish_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`poster_img` varchar(250) DEFAULT NULL,
`body` text DEFAULT NULL,
`user_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `role`
--
CREATE TABLE `role` (
`id` int(11) NOT NULL,
`name` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `role`
--
INSERT INTO `role` (`id`, `name`) VALUES
(1, 'admin'),
(2, 'author');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`full_name` varchar(45) NOT NULL,
`email` varchar(150) NOT NULL,
`profile_img` varchar(250) DEFAULT NULL,
`about` mediumtext DEFAULT NULL,
`password` varchar(255) NOT NULL,
`role_id` int(11) NOT NULL,
`date` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `full_name`, `email`, `profile_img`, `about`, `password`, `role_id`, `date`) VALUES
(1, 'administrator', 'admin@a.a', 'uploads/1697753498PXL_20230915_151720284.NIGHT.jpg', 'i can control the whole system', '$2y$10$Ylhr8RcBhRkPv7rzJUn/L.rk.RdX9oON98DkUSHM4luugoVCcoJsa', 1, '2023-09-26 21:14:21'),
(2, 'Ibrahim Sultan', 'aswh.abrahem@gmail.com', '', 'hmmmm', '$2y$10$1cmjtNrdsMN8sJj0XUpuSu43OZ8hRCnTuFzddW.M8MLokf7O5JdXG', 2, '2023-09-27 02:26:44'),
(5, 'Khaled Ali', 'a@S.c', 'uploads/1697755459OwnSticker_20230301_224953848.jpg', 'Shitty Author', '1212121212', 2, '2023-10-14 05:50:22'),
(9, 'Ahmed', 'ahmed@a.a', 'uploads/1697756048PXL_20230930_074030759.MP~3.jpg', '', '$2y$10$wkiyASkbzGJAwQf1KcGaHuDGf5p/qtswtV4UJuLY.BMknYdmmSUQa', 2, '2023-10-20 01:54:08'),
(10, 'test', 't@t.t', NULL, '', '$2y$10$w7AdK27j22FvAK.wzg.o0uuTtDDb34hcgUp/1IDDBun3SNksVgtt2', 2, '2023-10-20 02:13:31');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `post`
--
ALTER TABLE `post`
ADD PRIMARY KEY (`id`,`user_id`,`category_id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `category_id` (`category_id`);
--
-- Indexes for table `role`
--
ALTER TABLE `role`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD KEY `role_id` (`role_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `post`
--
ALTER TABLE `post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `role`
--
ALTER TABLE `role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `post`
--
ALTER TABLE `post`
ADD CONSTRAINT `post_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `post_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE;
--
-- Constraints for table `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE;
COMMIT;
/*!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 */;