Skip to content

Commit

Permalink
Merge pull request #2 from jaimecabrera911/main
Browse files Browse the repository at this point in the history
  • Loading branch information
glrodasz authored Oct 22, 2023
2 parents 2d23af4 + 64ddb45 commit 92c22d1
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
Binary file added databases/jaimeacabreraa-5609/model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions databases/jaimeacabreraa-5609/scripts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Scripts

```sql
-- Crear tabla users

CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
)

--- Crear tabla categories

CREATE TABLE `categories` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
)

--- Crear tabla posts

CREATE TABLE `posts` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL,
`content` text NOT NULL,
`user_id` int NOT NULL,
`category_id` int NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id_idx` (`user_id`),
KEY `category_id_idx` (`category_id`)
)

---Crear tabla comments

CREATE TABLE `comments` (
`id` int NOT NULL AUTO_INCREMENT,
`post_id` int NOT NULL,
`user_id` int NOT NULL,
`content` text NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `post_idx` (`post_id`),
KEY `user_id_idx` (`user_id`)
)





0 comments on commit 92c22d1

Please sign in to comment.