-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
210 lines (195 loc) · 3.83 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
CREATE DATABASE IF NOT EXISTS instagram_laravel;
USE instagram_laravel;
/*Tabla de usuarios*/
CREATE TABLE IF NOT EXISTS users(
id int(255) auto_increment not null,
role varchar(20),
name varchar(100),
surname varchar(200),
nickname varchar(100),
email varchar(255),
password varchar(255),
image varchar(255),
created_at datetime,
updated_at datetime,
remember_token varchar(255),
CONSTRAINT pk_users PRIMARY KEY(id)
)ENGINE=InnoDb;
/*INSERTAR DATOS*/
INSERT INTO users VALUES(
NULL,
'user',
'Franco',
'Fonseca',
'franFon',
'frankito@gmail.com',
'frankito',
NULL,
CURTIME(),
CURTIME(),
NULL
);
INSERT INTO users VALUES(
NULL,
'user',
'Julian',
'Ponce',
'juliPonce',
'juliPonce@gmail.com',
'julito',
NULL,
CURTIME(),
CURTIME(),
NULL
);
INSERT INTO users VALUES(
NULL,
'user',
'Leonel',
'Moyano',
'moyano.leonel',
'leonelmoyano1809@gmail.com',
'pass1234',
NULL,
CURTIME(),
CURTIME(),
NULL
);
/*Tabla de imágenes*/
CREATE TABLE IF NOT EXISTS images(
id int(255) auto_increment not null,
user_id int(255),
image_path varchar(255),
description text,
created_at datetime,
updated_at datetime,
CONSTRAINT pk_images PRIMARY KEY(id),
CONSTRAINT fk_images_users FOREIGN KEY(user_id) REFERENCES users(id)
)ENGINE=InnoDb;
/*INSERTAR DATOS*/
INSERT INTO images VALUES(
NULL,
1,
'test.jpg',
'Pueba de imagen 1-1',
CURTIME(),
CURTIME()
);
INSERT INTO images VALUES(
NULL,
1,
'playa.jpg',
'Pueba de imagen 1-2',
CURTIME(),
CURTIME()
);
INSERT INTO images VALUES(
NULL,
1,
'arena.jpg',
'Pueba de imagen 1-3',
CURTIME(),
CURTIME()
);
INSERT INTO images VALUES(
NULL,
2,
'test.jpg',
'Pueba de imagen 2-1',
CURTIME(),
CURTIME()
);
INSERT INTO images VALUES(
NULL,
2,
'playa.jpg',
'Pueba de imagen 2-1',
CURTIME(),
CURTIME()
);
INSERT INTO images VALUES(
NULL,
3,
'test.jpg',
'Pueba de imagen 3-1',
CURTIME(),
CURTIME()
);
/*Tabla de comentarios*/
CREATE TABLE IF NOT EXISTS comments(
id int(255) auto_increment not null,
user_id int(255),
image_id int(255),
content text,
created_at datetime,
updated_at datetime,
CONSTRAINT pk_comments PRIMARY KEY(id),
CONSTRAINT fk_comments_users FOREIGN KEY(user_id) REFERENCES users(id),
CONSTRAINT fk_comments_images FOREIGN KEY(image_id) REFERENCES images(id)
)ENGINE=InnoDb;
/*INSERTAR DATOS*/
INSERT INTO comments VALUES(
NULL,
1,
4,
'Buena foto maquina',
CURTIME(),
CURTIME()
);
INSERT INTO comments VALUES(
NULL,
2,
2,
'Alta playa pibe',
CURTIME(),
CURTIME()
);
INSERT INTO comments VALUES(
NULL,
3,
4,
'Fachero mal',
CURTIME(),
CURTIME()
);
INSERT INTO comments VALUES(
NULL,
3,
2,
'Miami un poroto',
CURTIME(),
CURTIME()
);
/*Tabla de likes*/
CREATE TABLE IF NOT EXISTS likes(
id int(255) auto_increment not null,
user_id int(255),
image_id int(255),
created_at datetime,
updated_at datetime,
CONSTRAINT pk_likes PRIMARY KEY(id),
CONSTRAINT fk_likes_users FOREIGN KEY(user_id) REFERENCES users(id),
CONSTRAINT fk_likes_images FOREIGN KEY(image_id) REFERENCES images(id)
)ENGINE=InnoDb;
/*INSERTAR DATOS*/
INSERT INTO likes VALUES(
NULL,
1,
4,
CURTIME(),
CURTIME()
);
INSERT INTO likes VALUES(
NULL,
3,
4,
CURTIME(),
CURTIME()
);
INSERT INTO likes VALUES(
NULL,
2,
1,
CURTIME(),
CURTIME()
);