DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS dates_user;
DROP TABLE IF EXISTS fact_1_date;
DROP TABLE IF EXISTS fact_2_date;
DROP TABLE IF EXISTS reponses;
CREATE TABLE `users` (
`id` INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
`utilisateur` TEXT NOT NULL ,
`pword` TEXT NOT NULL
);

CREATE TABLE `dates_user` (
`id` INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
`users_id` INTEGER NOT NULL ,
`date` DATE NOT NULL  ,
`heure` TIME NOT NULL  
);

CREATE TABLE `fact_1_date` (
`id` INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
`dates_user_id` INTEGER  NOT NULL,
`fact1_1` INTEGER NOT NULL ,
`fact1_2` INTEGER NOT NULL,
`fact1_3` INTEGER NOT NULL,
`fact1_4` INTEGER NOT NULL,
`fact1_5` INTEGER NOT NULL,
`fact1_6` INTEGER NOT NULL,
`fact1_7` INTEGER NOT NULL,
`fact1_8` INTEGER NOT NULL,
`fact1_9` INTEGER NOT NULL,
`fact1_10` INTEGER NOT NULL
);


CREATE TABLE `fact_2_date` (
`id` INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
`dates_user_id` INTEGER  NOT NULL,
`fact2_1` INTEGER  NOT NULL,
`fact2_2` INTEGER  NOT NULL,
`fact2_3` INTEGER  NOT NULL,
`fact2_4` INTEGER  NOT NULL,
`fact2_5` INTEGER  NOT NULL,
`fact2_6` INTEGER  NOT NULL,
`fact2_7` INTEGER  NOT NULL,
`fact2_8` INTEGER  NOT NULL,
`fact2_9` INTEGER  NOT NULL,
`fact2_10` INTEGER  NOT NULL
);

CREATE TABLE `reponses` (
`id` INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
`fact_1_date_id` INTEGER  NOT NULL,
`fact_2_date_id` INTEGER  NOT NULL,
`rep_1` INTEGER NULL  default '0',
`rep_2` INTEGER NULL  default '0',
`rep_3` INTEGER NULL  default '0',
`rep_4` INTEGER NULL  default '0',
`rep_5` INTEGER NULL  default '0',
`rep_6` INTEGER NULL default '0',
`rep_8` INTEGER NULL  default '0',
`rep_9` INTEGER NULL  default '0',
`rep_10` INTEGER NULL  default '0'
);
