Skip to content

Commit 2aa31a0

Browse files
authored
Update README.md
1 parent 3dd1a68 commit 2aa31a0

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,40 @@ When the application is running, the documentation is available at the following
1818
http://localhost:8080/swagger-ui.html
1919
```
2020

21+
## Database
22+
Following SQL script is used to create a MySQL database for storing users and videos data.
23+
```sql
24+
#create database
25+
CREATE DATABASE live-stremaing;
26+
27+
#switch to newly created database
28+
USE live-streaming;
29+
30+
#create users table
31+
CREATE TABLE `users` (
32+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
33+
`username` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
34+
`password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
35+
`created` datetime DEFAULT NULL,
36+
`modified` datetime DEFAULT NULL,
37+
PRIMARY KEY (`id`),
38+
UNIQUE KEY `username` (`username`)
39+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
40+
41+
#create videos table
42+
CREATE TABLE `videos` (
43+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
44+
`user_id` int(10) unsigned NOT NULL,
45+
`title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
46+
`size` double DEFAULT NULL,
47+
`url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
48+
`created` datetime DEFAULT NULL,
49+
`modified` datetime DEFAULT NULL,
50+
PRIMARY KEY (`id`),
51+
KEY `fk_videos_users_idx` (`user_id`),
52+
CONSTRAINT `fk_videos_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
53+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
54+
```
55+
2156
## License
22-
MIT
57+
MIT

0 commit comments

Comments
 (0)