generated from glrodasz/semana-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jaimecabrera911/main
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`) | ||
) | ||
|
||
|
||
|
||
|
||
|