-- ALTER TABLE `visiteur_bac` ADD COLUMN `lieu` VARCHAR(50) NULL DEFAULT NULL AFTER `autre_serie`;

-- ALTER TABLE `utilisateur` ADD COLUMN `lang` VARCHAR(5) NULL DEFAULT 'fr' AFTER `image`;

-- ALTER TABLE `visiteur` ADD COLUMN `parcours` VARCHAR(5) NULL DEFAULT NULL AFTER `pere_cnss`;

-- ALTER TABLE `filiere` ADD COLUMN `abbr` VARCHAR(20) NULL DEFAULT NULL AFTER `nom`;


-- ALTER TABLE `classe` ADD COLUMN `abbr` VARCHAR(25) NULL DEFAULT NULL AFTER `nom`;

-- ALTER TABLE `classe` ADD COLUMN `option` VARCHAR(25) NULL DEFAULT NULL AFTER `abbr`;

-- ALTER TABLE `visiteur` ADD COLUMN `situation_famille` VARCHAR(25) NULL DEFAULT NULL AFTER `cin`;

-- CREATE TABLE role(
-- 	id INT AUTO_INCREMENT,
-- 	role_nom VARCHAR(30) NOT NULL,
-- 	PRIMARY KEY(id)
-- 	);

-- INSERT INTO `supmti_db_reinscription`.`role` (`role_nom`) VALUES ('Responsable des documents');

-- INSERT INTO `supmti_db_reinscription`.`role` (`role_nom`) VALUES ('Responsable service d\'appel');

-- INSERT INTO `supmti_db_reinscription`.`role` (`role_nom`) VALUES ('Responsable de paiement');

-- ALTER TABLE `inscription` 
-- 	ADD COLUMN `document_complet` TINYINT NULL DEFAULT 0 AFTER `deja_tretee`,
-- 	ADD COLUMN `paiment_valide` TINYINT NULL DEFAULT 0 AFTER `document_complet`;


-- ALTER TABLE `admin`
-- 	ADD COLUMN `role_id` INT NULL DEFAULT NULL AFTER `principale`;

-- ALTER TABLE `inscription`
--	ADD COLUMN `ins_saved` TINYINT(1) NULL DEFAULT '0' AFTER `date_derniere_changement`;

/*CREATE TABLE traitement(
	id INT AUTO_INCREMENT,
	`date` BIGINT NOT NULL,
	`action` MEDIUMTEXT NOT NULL,
	ins_id INT DEFAULT NULL,
	userid INT NOT NULL,
	PRIMARY KEY(id)
	);*/

-- ALTER TABLE `inscription` ADD COLUMN `ins_deleted` TINYINT(1) NULL DEFAULT '0' AFTER `ins_saved`; 

/*CREATE TABLE inscription_option(
	id INT AUTO_INCREMENT,
	nom VARCHAR(100) NOT NULL,
	PRIMARY KEY(id)
	);

INSERT INTO inscription_option (nom) VALUES
('Voir le profile de visiteur'),
('Télécharger la fiche d\'inscription'),
('Changer l\'état de préinscription'),
('Ajouter une remarque'),
('Enregistrer dans la base de donnée'),
('Supprimer l\'inscription'),
('les actions des utilisateurs');
	
CREATE TABLE permission_context(
	id INT AUTO_INCREMENT,
	nom VARCHAR(50) NOT NULL,
	PRIMARY KEY(id)
	);
	
INSERT INTO permission_context(nom) VALUES 
('menu'),
('option'),
('role');

CREATE TABLE menu(
	id INT AUTO_INCREMENT,
	nom VARCHAR(200) NOT NULL,
	url VARCHAR(200) NOT NULL,
	PRIMARY KEY(id)
	);

ALTER TABLE `menu`
	ADD COLUMN `icon` VARCHAR(20) NULL DEFAULT NULL AFTER `url`;

INSERT INTO `menu` (`nom`, `url`, `icon`)
VALUES
('liste inscription', 'tableau_bord', 'fa-list-alt'),
('liste utilisateur', 'utilisateur/list', 'fa-users');

CREATE TABLE utilisateur_permission(
	id INT AUTO_INCREMENT,
	userid INT,
	context_id INT,
	permission_id INT,
	PRIMARY KEY(id)
	);

COLUMN `tel` `tel` VARCHAR(30) NULL DEFAULT NULL AFTER `prenom`;
*/

-- INSERT INTO `supmti_db_reinscription`.`inscription_option` (`nom`) VALUES ('Transferer les documents');

/*ALTER TABLE `inscription`
	ADD COLUMN `ins_ancien` TINYINT(1) NULL DEFAULT '0' AFTER `ins_deleted`;

CREATE TABLE attestation_generer(
	id INT AUTO_INCREMENT,
	attes_code VARCHAR(200) NOT NULL,
	date_generation BIGINT NOT NULL,
	ins_id INT NOT NULL,
	PRIMARY KEY(id)
	);

ALTER TABLE `attestation_generer`
	ADD COLUMN `attestation_id` INT(11) NOT NULL AFTER `ins_id`;
*/

/*CREATE TABLE attestation(
	id INT AUTO_INCREMENT,
	nom VARCHAR(30) NOT NULL,
	PRIMARY KEY(id)
	);

INSERT INTO attestation (nom) VALUES
('Attestation d\'acceptation'),
('Attestation d\'inscription');


ALTER TABLE `inscription` ADD COLUMN `ins_etud_id` INT NULL DEFAULT NULL COMMENT 'etudiant id comming from app.supmti.ac.ma' AFTER `ins_ancien`;

INSERT INTO `permission_context` (`nom`) VALUES ('profile');
*/

/*CREATE TABLE profile_options(
	id INT AUTO_INCREMENT,
	nom VARCHAR(90) NOT NULL,
	PRIMARY KEY(id)
	);
	

INSERT INTO profile_options(nom) VALUES
('Voir le document'),
('Changer l\'état de document'),
('Supprimer le document'),
('Ajouter d\'autres documents');

*/

/*ALTER TABLE `attestation_generer` ADD COLUMN `attes_deleted` TINYINT NOT NULL DEFAULT '0' AFTER `attestation_id`;

CREATE TABLE tag(
	id INT AUTO_INCREMENT,
	nom VARCHAR(100) NOT NULL,
	description MEDIUMTEXT,
	utilisateur_id INT NOT NULL,
	PRIMARY KEY(id)
	);

CREATE TABLE inscription_tag(
	id INT AUTO_INCREMENT,
	inscription_id INT,
	tag_id INT,
	PRIMARY KEY(id)
	);

INSERT INTO `inscription_option` (`nom`) VALUES ('Associer l\'inscription avec des tags');*/

-- ALTER TABLE `inscription_tag` ADD COLUMN `user_id` INT(11) NULL DEFAULT NULL AFTER `tag_id`;

/*ALTER TABLE `document`
	ADD COLUMN `can_exclude` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Determin if document can be excluded to allow users to get their documents' AFTER `nom`;

ALTER TABLE `inscription` DROP COLUMN `ins_etud_id`;

ALTER TABLE `visiteur`
	ADD COLUMN `etudiant_id` INT NULL DEFAULT NULL AFTER `comment_connu_ecole`;
*/

-- INSERT INTO  inscription_option (`nom`) VALUES ('Modifier les données');

-- INSERT INTO `supmti_db_reinscription`.`inscription_option` (`nom`) VALUES ('Lier l\'inscription avec un étudiant');

ALTER TABLE `visiteur` ADD COLUMN `droit_modif` TINYINT(1) NULL DEFAULT '1' AFTER `etudiant_id`;