-
Notifications
You must be signed in to change notification settings - Fork 0
/
POLY_INT_MYSQL.rtf
194 lines (193 loc) · 6.84 KB
/
POLY_INT_MYSQL.rtf
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
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\f0\fs24 \cf0 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;\
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;\
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';\
\
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;\
USE `mydb` ;\
\
-- -----------------------------------------------------\
-- Table `mydb`.`POLY_INT_schools`\
-- -----------------------------------------------------\
CREATE TABLE IF NOT EXISTS `mydb`.`POLY_INT_schools` (\
`id` INT NOT NULL AUTO_INCREMENT,\
`name` VARCHAR(45) NULL,\
`created` DATETIME NULL,\
`modified` DATETIME NULL,\
PRIMARY KEY (`id`))\
ENGINE = InnoDB;\
\
\
-- -----------------------------------------------------\
-- Table `mydb`.`POLY_INT_departments`\
-- -----------------------------------------------------\
CREATE TABLE IF NOT EXISTS `mydb`.`POLY_INT_departments` (\
`id` INT NOT NULL AUTO_INCREMENT,\
`name` VARCHAR(45) NULL,\
`created` DATETIME NULL,\
`modified` DATETIME NULL,\
PRIMARY KEY (`id`))\
ENGINE = InnoDB;\
\
\
-- -----------------------------------------------------\
-- Table `mydb`.`POLY_INT_users`\
-- -----------------------------------------------------\
CREATE TABLE IF NOT EXISTS `mydb`.`POLY_INT_users` (\
`id` INT NOT NULL AUTO_INCREMENT,\
`role` VARCHAR(10) NOT NULL,\
`email` VARCHAR(45) NULL,\
`password` VARCHAR(45) NULL,\
`firstname` VARCHAR(45) NULL,\
`lastname` VARCHAR(45) NULL,\
`facebook_url` VARCHAR(45) NULL,\
`twitter_url` VARCHAR(45) NULL,\
`linkedin_url` VARCHAR(45) NULL,\
`viadeo_url` VARCHAR(45) NULL,\
`created` DATETIME NULL,\
`modified` DATETIME NULL,\
`school_id` INT NOT NULL,\
`department_id` INT NOT NULL,\
PRIMARY KEY (`id`),\
INDEX `fk_POLY_INT_users_POLY_INT_schools1_idx` (`school_id` ASC),\
INDEX `fk_POLY_INT_users_POLY_INT_departments1_idx` (`department_id` ASC),\
CONSTRAINT `fk_POLY_INT_users_POLY_INT_schools1`\
FOREIGN KEY (`school_id`)\
REFERENCES `mydb`.`POLY_INT_schools` (`id`)\
ON DELETE NO ACTION\
ON UPDATE NO ACTION,\
CONSTRAINT `fk_POLY_INT_users_POLY_INT_departments1`\
FOREIGN KEY (`department_id`)\
REFERENCES `mydb`.`POLY_INT_departments` (`id`)\
ON DELETE NO ACTION\
ON UPDATE NO ACTION)\
ENGINE = InnoDB;\
\
\
-- -----------------------------------------------------\
-- Table `mydb`.`POLY_INT_countries`\
-- -----------------------------------------------------\
CREATE TABLE IF NOT EXISTS `mydb`.`POLY_INT_countries` (\
`id` VARCHAR(3) NOT NULL,\
`name` VARCHAR(45) NULL,\
`experienceNumber` INT NULL DEFAULT 0,\
`created` DATETIME NULL,\
`modified` DATETIME NULL,\
PRIMARY KEY (`id`))\
ENGINE = InnoDB;\
\
\
-- -----------------------------------------------------\
-- Table `mydb`.`POLY_INT_cities`\
-- -----------------------------------------------------\
CREATE TABLE IF NOT EXISTS `mydb`.`POLY_INT_cities` (\
`id` INT NOT NULL AUTO_INCREMENT,\
`name` VARCHAR(45) NULL,\
`lat` VARCHAR(45) NULL,\
`lon` VARCHAR(45) NULL,\
`experienceNumber` INT NULL DEFAULT 0,\
`created` DATETIME NULL,\
`modified` DATETIME NULL,\
`country_id` VARCHAR(3) NOT NULL,\
PRIMARY KEY (`id`),\
INDEX `fk_POLY_INT_cities_POLY_INT_countries1_idx` (`country_id` ASC),\
CONSTRAINT `fk_POLY_INT_cities_POLY_INT_countries1`\
FOREIGN KEY (`country_id`)\
REFERENCES `mydb`.`POLY_INT_countries` (`id`)\
ON DELETE NO ACTION\
ON UPDATE NO ACTION)\
ENGINE = InnoDB;\
\
\
-- -----------------------------------------------------\
-- Table `mydb`.`POLY_INT_motives`\
-- -----------------------------------------------------\
CREATE TABLE IF NOT EXISTS `mydb`.`POLY_INT_motives` (\
`id` INT NOT NULL AUTO_INCREMENT,\
`name` VARCHAR(45) NULL,\
`created` DATETIME NULL,\
`modified` DATETIME NULL,\
PRIMARY KEY (`id`))\
ENGINE = InnoDB;\
\
\
-- -----------------------------------------------------\
-- Table `mydb`.`POLY_INT_experiences`\
-- -----------------------------------------------------\
CREATE TABLE IF NOT EXISTS `mydb`.`POLY_INT_experiences` (\
`id` INT NOT NULL AUTO_INCREMENT,\
`dateStart` DATETIME NULL,\
`dateEnd` DATETIME NULL,\
`description` VARCHAR(140) NULL,\
`note` INT NULL,\
`comment` TINYTEXT NULL,\
`notify` TINYINT(1) NULL,\
`created` DATETIME NULL,\
`modified` DATETIME NULL,\
`city_id` INT NOT NULL,\
`motive_id` INT NOT NULL,\
`user_id` INT NOT NULL,\
PRIMARY KEY (`id`),\
INDEX `fk_experiences_cities1_idx` (`city_id` ASC),\
INDEX `fk_experiences_motives1_idx` (`motive_id` ASC),\
INDEX `fk_experiences_users1_idx` (`user_id` ASC),\
CONSTRAINT `fk_experiences_cities1`\
FOREIGN KEY (`city_id`)\
REFERENCES `mydb`.`POLY_INT_cities` (`id`)\
ON DELETE NO ACTION\
ON UPDATE NO ACTION,\
CONSTRAINT `fk_experiences_motives1`\
FOREIGN KEY (`motive_id`)\
REFERENCES `mydb`.`POLY_INT_motives` (`id`)\
ON DELETE NO ACTION\
ON UPDATE NO ACTION,\
CONSTRAINT `fk_experiences_users1`\
FOREIGN KEY (`user_id`)\
REFERENCES `mydb`.`POLY_INT_users` (`id`)\
ON DELETE NO ACTION\
ON UPDATE NO ACTION)\
ENGINE = InnoDB;\
\
\
SET SQL_MODE=@OLD_SQL_MODE;\
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;\
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;\
\
-- -----------------------------------------------------\
-- Data for table `mydb`.`POLY_INT_schools`\
-- -----------------------------------------------------\
START TRANSACTION;\
USE `mydb`;\
INSERT INTO `mydb`.`POLY_INT_schools` (`id`, `name`, `created`, `modified`) VALUES (1, 'Nantes', NULL, NULL);\
INSERT INTO `mydb`.`POLY_INT_schools` (`id`, `name`, `created`, `modified`) VALUES (2, 'Tours', NULL, NULL);\
\
COMMIT;\
\
\
-- -----------------------------------------------------\
-- Data for table `mydb`.`POLY_INT_departments`\
-- -----------------------------------------------------\
START TRANSACTION;\
USE `mydb`;\
INSERT INTO `mydb`.`POLY_INT_departments` (`id`, `name`, `created`, `modified`) VALUES (1, 'Informatique', NULL, NULL);\
INSERT INTO `mydb`.`POLY_INT_departments` (`id`, `name`, `created`, `modified`) VALUES (2, 'Mat\'e9riaux', NULL, NULL);\
\
COMMIT;\
\
\
-- -----------------------------------------------------\
-- Data for table `mydb`.`POLY_INT_motives`\
-- -----------------------------------------------------\
START TRANSACTION;\
USE `mydb`;\
INSERT INTO `mydb`.`POLY_INT_motives` (`id`, `name`, `created`, `modified`) VALUES (1, 'Stage', NULL, NULL);\
INSERT INTO `mydb`.`POLY_INT_motives` (`id`, `name`, `created`, `modified`) VALUES (2, 'Semestre', NULL, NULL);\
INSERT INTO `mydb`.`POLY_INT_motives` (`id`, `name`, `created`, `modified`) VALUES (3, 'Voyage', NULL, NULL);\
\
COMMIT;\
\
}