-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.sql
27 lines (24 loc) · 987 Bytes
/
database.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
CREATE DATABASE IF NOT EXISTS api_rest_symfony;
USE api_rest_symfony;
CREATE TABLE users(
id int(255) auto_increment not null,
name varchar(50) NOT NULL,
surname varchar(150),
email varchar(255) NOT NULL,
password varchar(255) NOT NULL,
role varchar(20) NOT NULL,
created_at datetime DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_users PRIMARY KEY(id)
)ENGINE=InnoDb;
CREATE TABLE videos(
id int(255) auto_increment not null,
user_id int(255) not null,
title varchar(250) NOT NULL,
description text,
url varchar(255) NOT NULL,
status varchar(50) NOT NULL,
created_at datetime DEFAULT CURRENT_TIMESTAMP,
updated_at datetime DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_videos PRIMARY KEY(id),
CONSTRAINT fk_video_user FOREIGN KEY(user_id) REFERENCES users(id)
)ENGINE=InnoDb;