-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
30 lines (29 loc) · 1.3 KB
/
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
-- Create users table
CREATE TABLE IF NOT EXISTS `users`
(
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`username` VARCHAR(50) NOT NULL UNIQUE,
`password` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
`is_admin` ENUM ('Y', 'N') DEFAULT 'N',
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS `settings`
(
`blogTitle` VARCHAR(50) NOT NULL,
`blogDescription` VARCHAR(150) NOT NULL,
`blogAuthor` VARCHAR(40) NOT NULL,
`blogAuthorInfo` VARCHAR(250) NOT NULL
);
CREATE TABLE IF NOT EXISTS `posts`
(
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` INT NOT NULL,
`title` VARCHAR(255) NOT NULL,
`body` TEXT NOT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`published` ENUM ('Y', 'N') NOT NULL DEFAULT 'N'
);
INSERT INTO `settings`(`blogTitle`, `blogDescription`, `blogAuthor`, `blogAuthorInfo`) VALUES ('Blog', 'Simple Blog', 'Jonh', 'Pro developer');
INSERT INTO `users`(`username`, `password`, `email`, `is_admin`) VALUES ('admin', '$2y$10$sJp2evNq5fp8SkJu7CfGQOmY7pIMHFLd09eORbCVabkHlinn6RoOm', 'email@riseup.net', 'Y');
commit;