forked from EphecLLN/Dev-Web-2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgabrielle_squelin.sql
73 lines (67 loc) · 2.94 KB
/
gabrielle_squelin.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
CREATE TABLE `users` (
`user_id` int NOT NULL AUTO_INCREMENT,
`last_name` varchar(45) NOT NULL,
`first_name` varchar(45) NOT NULL,
`password` varchar(45) DEFAULT NULL,
`email` varchar(50) NOT NULL,
`phone` varchar(45) DEFAULT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `id_users_UNIQUE` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `galery` (
`img_id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL,
`img` varchar(255),
`creation` datetime NOT NULL,
`modification` datetime NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1=Active | 0=Inactive',
PRIMARY KEY (`img_id`),
UNIQUE KEY `id_imgs_UNIQUE` (`img_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
CREATE TABLE `lessons` (
`lesson_id` int NOT NULL AUTO_INCREMENT,
`name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL,
`description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL,
`session_start` int NOT NULL,
`session_finish` int NOT NULL,
`date` datetime NOT NULL,
`places_number` int DEFAULT '0',
PRIMARY KEY (`lesson_id`),
UNIQUE KEY `id_lessons_UNIQUE` (`lesson_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
CREATE TABLE `orders` (
`order_id` int NOT NULL AUTO_INCREMENT,
`type` varchar(45) NOT NULL,
`occasion` varchar(45) NOT NULL,
`date` date NOT NULL,
`comment` longtext,
`img` varchar(255),
PRIMARY KEY (`order_id`),
UNIQUE KEY `id_orders_UNIQUE` (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `lesson_users` (
`lesson_id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
PRIMARY KEY (`lesson_id`,`user_id`),
KEY `FK_user_id_idx` (`user_id`),
CONSTRAINT `FK_lesson_id` FOREIGN KEY (`lesson_id`) REFERENCES `lessons` (`lesson_id`),
CONSTRAINT `FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
CREATE TABLE `orders_users` (
`order_id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
PRIMARY KEY (`order_id`,`user_id`),
UNIQUE KEY `order_id_UNIQUE` (`order_id`),
KEY `FK_user_id_idx` (`user_id`),
CONSTRAINT `FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`),
CONSTRAINT `FK_order_id` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `galery_site` (
`galery_id` int NOT NULL AUTO_INCREMENT,
`img_id` int NOT NULL,
`galery_nom` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL,
`date_upload` datetime NOT NULL,
PRIMARY KEY (`galery_id`),
KEY `FK_img_id_idx` (`img_id`),
CONSTRAINT `FK_img_id` FOREIGN KEY (`img_id`) REFERENCES `galery` (`img_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;