-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbdd.sql
More file actions
69 lines (65 loc) · 2.24 KB
/
bdd.sql
File metadata and controls
69 lines (65 loc) · 2.24 KB
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
create table users
(
id int auto_increment
primary key,
firstName varchar(100) null,
lastName varchar(100) null,
gender varchar(10) null,
created_date date not null,
city varchar(100) not null,
country varchar(100) not null,
bio varchar(255) null,
last_connexion date not null,
birth_date date not null,
looking varchar(100) null,
distance int null,
username varchar(100) not null,
password varchar(100) not null,
email varchar(255) not null,
updated_date date not null,
min_age int null,
max_age int null,
status tinyint(1) not null,
constraint email
unique (email),
constraint username
unique (username)
);
create table images
(
id int auto_increment
primary key,
user_id int not null,
url varchar(255) not null,
created_date date not null,
`order` int not null,
constraint images_users_fk
foreign key (user_id) references users (id)
);
create table `match`
(
id int auto_increment
primary key,
action varchar(100) not null comment 'unlike, super like or like',
first_user int not null comment 'user id who send the match in first',
second_user int not null comment 'user id who send the match in second',
constraint match_users_first_fk
foreign key (first_user) references users (id),
constraint match_users_second_fk
foreign key (second_user) references users (id)
);
create table messages
(
id int auto_increment
primary key,
id_sender int not null comment 'user how send in first the message to an another user',
id_receiver int not null,
message varchar(255) not null,
send_at date not null,
read_at time null,
constraint messages_receiver_id_fk
foreign key (id_receiver) references users (id),
constraint messages_sender_id_fk
foreign key (id_sender) references users (id)
);
create database tinder;