CREATE TABLE files (
    id INT AUTO_INCREMENT PRIMARY KEY,
    account_id INT NOT NULL,
    etab_id INT,
    site_id INT,
    implantation_id INT,
    autorisation_id INT,
    file_name VARCHAR(255),
    file_hash VARCHAR(255),
    file_ext VARCHAR(10),
    FOREIGN KEY (account_id) REFERENCES accounts(id),
    FOREIGN KEY (etab_id) REFERENCES etablissements(id),
    FOREIGN KEY (site_id) REFERENCES sites(id),
    FOREIGN KEY (implantation_id) REFERENCES implantations(id),
    FOREIGN KEY (autorisation_id) REFERENCES autorisations(id)
);


ALTER TABLE `gestetab`.`users` 
CHANGE COLUMN `admin_all` `admin_account` INT(11) NULL DEFAULT '0' ;
