CREATE TABLE `tags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `account_id` int(11) NOT NULL,
  `name` varchar(90) DEFAULT NULL,
  `status_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=latin1;


CREATE TABLE `gestetab`.`etab_tag` (
  `etab_id` INT NOT NULL,
  `tag_id` INT NOT NULL,
  `account_id` INT NULL);

ALTER TABLE `gestetab`.`etab_tag`
ADD CONSTRAINT uc_etab_tag UNIQUE (etab_id, tag_id);


ALTER TABLE `gestetab`.`etablissements` 
DROP COLUMN `sharepoint_lien`,
DROP COLUMN `autorisation_lien`,
DROP COLUMN `autorisation_date_fin`,
DROP COLUMN `autorisation_date_debut`,
DROP COLUMN `autorisation_code_numero`,
DROP COLUMN `autorisation_code_discipline`,
DROP COLUMN `autorisation_code_clientele`,
DROP COLUMN `autorisation_code_categorie`,
CHANGE COLUMN `type_id` `type` VARCHAR(90) NULL DEFAULT NULL ;

ALTER TABLE `gestetab`.`accounts` 
ADD COLUMN `group_admin_account` VARCHAR(90) NULL AFTER `tenant_id`,
ADD COLUMN `group_admin_etab` VARCHAR(90) NULL AFTER `group_admin_account`,
ADD COLUMN `group_admin_site` VARCHAR(90) NULL AFTER `group_admin_etab`;
