/*ALTER TABLE user ADD operateur_id INT DEFAULT NULL;
ALTER TABLE user ADD CONSTRAINT FK_8D93D6493F192FC FOREIGN KEY (operateur_id) REFERENCES operateur (id);
CREATE INDEX IDX_8D93D6493F192FC ON user (operateur_id);

CREATE TABLE chefferie (id INT AUTO_INCREMENT NOT NULL, territoire_id INT DEFAULT NULL, nom VARCHAR(255) DEFAULT NULL, INDEX IDX_43D2E11FD0F97A8 (territoire_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE production_methode (production_id INT NOT NULL, methode_id INT NOT NULL, INDEX IDX_B723CFE5ECC6147F (production_id), INDEX IDX_B723CFE541CCC9A4 (methode_id), PRIMARY KEY(production_id, methode_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE chefferie ADD CONSTRAINT FK_43D2E11FD0F97A8 FOREIGN KEY (territoire_id) REFERENCES territoire (id);
ALTER TABLE production_methode ADD CONSTRAINT FK_B723CFE5ECC6147F FOREIGN KEY (production_id) REFERENCES production (id) ON DELETE CASCADE;
ALTER TABLE production_methode ADD CONSTRAINT FK_B723CFE541CCC9A4 FOREIGN KEY (methode_id) REFERENCES methode (id) ON DELETE CASCADE;
ALTER TABLE village DROP FOREIGN KEY FK_4E6C7FAAD0F97A8;
DROP INDEX IDX_4E6C7FAAD0F97A8 ON village;
ALTER TABLE village CHANGE territoire_id chefferie_id INT DEFAULT NULL;
ALTER TABLE village ADD CONSTRAINT FK_4E6C7FAA5E83506B FOREIGN KEY (chefferie_id) REFERENCES chefferie (id);
CREATE INDEX IDX_4E6C7FAA5E83506B ON village (chefferie_id);
ALTER TABLE production ADD usine_id INT DEFAULT NULL, ADD village_id INT DEFAULT NULL, ADD observations LONGTEXT DEFAULT NULL;
ALTER TABLE production ADD CONSTRAINT FK_D3EDB1E0C0130686 FOREIGN KEY (usine_id) REFERENCES usine (id);
ALTER TABLE production ADD CONSTRAINT FK_D3EDB1E05E0D5582 FOREIGN KEY (village_id) REFERENCES village (id);
CREATE INDEX IDX_D3EDB1E0C0130686 ON production (usine_id);
CREATE INDEX IDX_D3EDB1E05E0D5582 ON production (village_id);

ALTER TABLE chefferie ADD user_id INT DEFAULT NULL, ADD created_at DATETIME DEFAULT NULL, ADD updated_at DATETIME DEFAULT NULL, ADD deleted_at DATETIME DEFAULT NULL;
ALTER TABLE chefferie ADD CONSTRAINT FK_43D2E11FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
CREATE INDEX IDX_43D2E11FA76ED395 ON chefferie (user_id);

ALTER TABLE production ADD nom_chantier VARCHAR(255) DEFAULT NULL;

CREATE TABLE loyer_annuel (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE production DROP FOREIGN KEY FK_D3EDB1E0286255B5;
DROP INDEX IDX_D3EDB1E0286255B5 ON production;
ALTER TABLE production DROP type_commodit_id, DROP concentres_sortis, DROP type_commodite;

CREATE TABLE production_type_commodite (production_id INT NOT NULL, type_commodite_id INT NOT NULL, INDEX IDX_59B7E8F7ECC6147F (production_id), INDEX IDX_59B7E8F729209030 (type_commodite_id), PRIMARY KEY(production_id, type_commodite_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE production_type_commodite ADD CONSTRAINT FK_59B7E8F7ECC6147F FOREIGN KEY (production_id) REFERENCES production (id) ON DELETE CASCADE;
ALTER TABLE production_type_commodite ADD CONSTRAINT FK_59B7E8F729209030 FOREIGN KEY (type_commodite_id) REFERENCES type_commodite (id) ON DELETE CASCADE;
ALTER TABLE production ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;

ALTER TABLE exportation ADD mois_annee_exportation VARCHAR(255) DEFAULT NULL;

ALTER TABLE vente_local ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL, ADD adresse_vendeur VARCHAR(255) DEFAULT NULL;
ALTER TABLE vente_local CHANGE adresse_vendeur adresse_acheteur VARCHAR(255) DEFAULT NULL;

ALTER TABLE redevance ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;
ALTER TABLE taxe ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;
ALTER TABLE impot ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;
ALTER TABLE droit ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;

ALTER TABLE redevance ADD devise VARCHAR(255) DEFAULT NULL;
ALTER TABLE taxe ADD devise VARCHAR(255) DEFAULT NULL;

CREATE TABLE presence (id INT AUTO_INCREMENT NOT NULL, centre_de_recherche_id INT DEFAULT NULL, agent_id INT DEFAULT NULL, absence_justifiee INT DEFAULT NULL, absence_non_justifiee INT DEFAULT NULL, taux_absenteisme DOUBLE PRECISION DEFAULT NULL, absence_cause_maladie INT DEFAULT NULL, conge_reconstitution INT DEFAULT NULL, conge_circonstance INT DEFAULT NULL, conge_en_cas_de_maladie INT DEFAULT NULL, maladies VARCHAR(255) DEFAULT NULL, circonstances VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mines NUMERIC(10, 2) DEFAULT NULL, INDEX IDX_6977C7A51CED11F9 (centre_de_recherche_id), INDEX IDX_6977C7A53414710B (agent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE presence ADD CONSTRAINT FK_6977C7A51CED11F9 FOREIGN KEY (centre_de_recherche_id) REFERENCES ouverture_centre_recherche (id);
ALTER TABLE presence ADD CONSTRAINT FK_6977C7A53414710B FOREIGN KEY (agent_id) REFERENCES membre (id);
ALTER TABLE membre ADD grade VARCHAR(255) DEFAULT NULL, ADD matricule VARCHAR(255) DEFAULT NULL, ADD categorie VARCHAR(255) DEFAULT NULL;

ALTER TABLE presence ADD user_id INT DEFAULT NULL, ADD created_at DATETIME DEFAULT NULL, ADD updated_at DATETIME DEFAULT NULL, ADD deleted_at DATETIME DEFAULT NULL;
ALTER TABLE presence ADD CONSTRAINT FK_6977C7A5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
CREATE INDEX IDX_6977C7A5A76ED395 ON presence (user_id);
ALTER TABLE presence ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;

ALTER TABLE presence ADD presences INT DEFAULT NULL, ADD maladie_absence VARCHAR(255) DEFAULT NULL;

CREATE TABLE travail_de_recherche (id INT AUTO_INCREMENT NOT NULL, centre_de_recherche_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, date_travail DATE DEFAULT NULL, nature_travail VARCHAR(255) DEFAULT NULL, numero_ouvrage VARCHAR(255) DEFAULT NULL, section_ouvrage VARCHAR(255) DEFAULT NULL, prevision NUMERIC(10, 2) NOT NULL, realisation NUMERIC(10, 2) DEFAULT NULL, ecart NUMERIC(10, 2) DEFAULT NULL, cumul_avancement_adate NUMERIC(10, 2) DEFAULT NULL, tonnage NUMERIC(10, 2) DEFAULT NULL, teneur NUMERIC(10, 2) DEFAULT NULL, difficultes_rencontrees LONGTEXT DEFAULT NULL, solutions_preconisees LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_72C8861B1CED11F9 (centre_de_recherche_id), INDEX IDX_72C8861BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE travail_de_recherche ADD CONSTRAINT FK_72C8861B1CED11F9 FOREIGN KEY (centre_de_recherche_id) REFERENCES ouverture_centre_recherche (id);
ALTER TABLE travail_de_recherche ADD CONSTRAINT FK_72C8861BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE chantier_de_recherche (id INT AUTO_INCREMENT NOT NULL, centre_de_recherche_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_accident DATE DEFAULT NULL, lieu_accident VARCHAR(255) DEFAULT NULL, description_accident LONGTEXT DEFAULT NULL, cause_accident VARCHAR(255) DEFAULT NULL, nombre_de_jour_perdu INT DEFAULT NULL, date_inspectionadministrative DATE DEFAULT NULL, service_inspection_administrative VARCHAR(255) DEFAULT NULL, objet_inspection_administrative VARCHAR(255) DEFAULT NULL, visiteurs VARCHAR(255) DEFAULT NULL, date_visite DATE NOT NULL, objet_visite VARCHAR(255) DEFAULT NULL, description_visite LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_1E4672521CED11F9 (centre_de_recherche_id), INDEX IDX_1E467252A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE chantier_de_recherche ADD CONSTRAINT FK_1E4672521CED11F9 FOREIGN KEY (centre_de_recherche_id) REFERENCES ouverture_centre_recherche (id);
ALTER TABLE chantier_de_recherche ADD CONSTRAINT FK_1E467252A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE chantier_de_recherche ADD cote_inspecteur_direction_mine NUMERIC(10, 2) NOT NULL;
ALTER TABLE operateur ADD logo VARCHAR(255) DEFAULT NULL;
CREATE TABLE echantillon_preleve (id INT AUTO_INCREMENT NOT NULL, centre_de_recherche_id INT DEFAULT NULL, pays_destination_id INT DEFAULT NULL, user_id INT DEFAULT NULL, orgine VARCHAR(255) DEFAULT NULL, type_ouvrage VARCHAR(255) DEFAULT NULL, lat NUMERIC(10, 2) NOT NULL, lng NUMERIC(10, 2) DEFAULT NULL, date_de_prelevement DATE DEFAULT NULL, nombre_echantillon INT DEFAULT NULL, volume NUMERIC(10, 2) DEFAULT NULL, poid_echantillon NUMERIC(10, 2) DEFAULT NULL, caracteristiques LONGTEXT DEFAULT NULL, lieu_emission VARCHAR(255) DEFAULT NULL, numero_formulaire VARCHAR(255) DEFAULT NULL, date_expedition DATE DEFAULT NULL, nom_destinataire VARCHAR(255) DEFAULT NULL, adresse_destinateur VARCHAR(255) DEFAULT NULL, charges LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, recommadations_inspecteur_direction_geologie LONGTEXT DEFAULT NULL, cote_inspecteur_direction_geologie NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_9AAB31FF1CED11F9 (centre_de_recherche_id), INDEX IDX_9AAB31FFD3356485 (pays_destination_id), INDEX IDX_9AAB31FFA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE echantillon_preleve_commodite (echantillon_preleve_id INT NOT NULL, commodite_id INT NOT NULL, INDEX IDX_6382030B5F808C95 (echantillon_preleve_id), INDEX IDX_6382030BAE632A35 (commodite_id), PRIMARY KEY(echantillon_preleve_id, commodite_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE echantillon_preleve ADD CONSTRAINT FK_9AAB31FF1CED11F9 FOREIGN KEY (centre_de_recherche_id) REFERENCES ouverture_centre_recherche (id);
ALTER TABLE echantillon_preleve ADD CONSTRAINT FK_9AAB31FFD3356485 FOREIGN KEY (pays_destination_id) REFERENCES pays (id);
ALTER TABLE echantillon_preleve ADD CONSTRAINT FK_9AAB31FFA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE echantillon_preleve_commodite ADD CONSTRAINT FK_6382030B5F808C95 FOREIGN KEY (echantillon_preleve_id) REFERENCES echantillon_preleve (id) ON DELETE CASCADE;
ALTER TABLE echantillon_preleve_commodite ADD CONSTRAINT FK_6382030BAE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id) ON DELETE CASCADE;

ALTER TABLE echantillon_preleve ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;

ALTER TABLE echantillon_preleve CHANGE lat lat NUMERIC(10, 2) DEFAULT NULL, CHANGE charges charges NUMERIC(10, 2) DEFAULT NULL;
ALTER TABLE echantillon_preleve ADD devise VARCHAR(255) DEFAULT NULL;

ALTER TABLE gisement ADD degre_carre VARCHAR(255) DEFAULT NULL, ADD type VARCHAR(255) DEFAULT NULL;
ALTER TABLE gisement ADD contexte_de_nimeralisation LONGTEXT DEFAULT NULL;
ALTER TABLE legislation CHANGE libelle libelle LONGTEXT DEFAULT NULL;

ALTER TABLE part_actionnaire CHANGE part part NUMERIC(20, 2) DEFAULT NULL;


CREATE TABLE fermeture_centre_de_recherche (id INT AUTO_INCREMENT NOT NULL, centre_de_recherche_id INT DEFAULT NULL, surete_financiere_id INT DEFAULT NULL, user_id INT DEFAULT NULL, numero_autorisation_environnementale VARCHAR(255) DEFAULT NULL, date_declaration_fermeture DATE DEFAULT NULL, moti_fermeture LONGTEXT DEFAULT NULL, numero_attestation_liberation_obligation_environnementale VARCHAR(255) DEFAULT NULL, date_approbation_declaration_fermeture DATE DEFAULT NULL, date_transmission_direction DATE DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_C677D6991CED11F9 (centre_de_recherche_id), INDEX IDX_C677D699D42EDD40 (surete_financiere_id), INDEX IDX_C677D699A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE fermeture_centre_de_recherche ADD CONSTRAINT FK_C677D6991CED11F9 FOREIGN KEY (centre_de_recherche_id) REFERENCES ouverture_centre_recherche (id);
ALTER TABLE fermeture_centre_de_recherche ADD CONSTRAINT FK_C677D699D42EDD40 FOREIGN KEY (surete_financiere_id) REFERENCES surete_financiere (id);
ALTER TABLE fermeture_centre_de_recherche ADD CONSTRAINT FK_C677D699A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE fermeture_centre_de_recherche ADD mois_annee_rapport DATE DEFAULT NULL;

CREATE TABLE travail_relatif_au_plan_environnemental (id INT AUTO_INCREMENT NOT NULL, centre_de_recherche_id INT DEFAULT NULL, user_id INT DEFAULT NULL, travaux_realises_en_execution_par_approuve LONGTEXT DEFAULT NULL, etat_avancement LONGTEXT DEFAULT NULL, resultats_obtenus LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, frais_engages NUMERIC(10, 2) DEFAULT NULL, devise VARCHAR(255) DEFAULT NULL, observations_inspecteur_direction LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_E4E366DF1CED11F9 (centre_de_recherche_id), INDEX IDX_E4E366DFA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE travail_relatif_au_plan_environnemental ADD CONSTRAINT FK_E4E366DF1CED11F9 FOREIGN KEY (centre_de_recherche_id) REFERENCES ouverture_centre_recherche (id);
ALTER TABLE travail_relatif_au_plan_environnemental ADD CONSTRAINT FK_E4E366DFA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE registre_de_surete_financiere (id INT AUTO_INCREMENT NOT NULL, centre_de_recherche_id INT DEFAULT NULL, user_id INT DEFAULT NULL, type_operation VARCHAR(255) DEFAULT NULL, duree_du_projet VARCHAR(255) DEFAULT NULL, exercice VARCHAR(255) DEFAULT NULL, montant_prevu NUMERIC(10, 2) DEFAULT NULL, devise VARCHAR(255) DEFAULT NULL, numero_bordereau VARCHAR(255) DEFAULT NULL, date_bordereau DATE DEFAULT NULL, echeanciers DATE DEFAULT NULL, releve_trimestriel VARCHAR(255) DEFAULT NULL, montant_verse NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction LONGTEXT DEFAULT NULL, cote_inspecteur_direction NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_783E9E4C1CED11F9 (centre_de_recherche_id), INDEX IDX_783E9E4CA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE registre_de_surete_financiere ADD CONSTRAINT FK_783E9E4C1CED11F9 FOREIGN KEY (centre_de_recherche_id) REFERENCES ouverture_centre_recherche (id);
ALTER TABLE registre_de_surete_financiere ADD CONSTRAINT FK_783E9E4CA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
DROP TABLE loyer_annuel;

ALTER TABLE registre_de_surete_financiere ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL, ADD devise_montant_verse VARCHAR(255) DEFAULT NULL;

CREATE TABLE loyer_annuel (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE operateur ADD token LONGTEXT DEFAULT NULL;

ALTER TABLE operateur ADD domaine VARCHAR(255) DEFAULT NULL;
ALTER TABLE projet ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE transformation ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE cession ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE titre_minier ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE transfert ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE `option` ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE arrete ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE contrat_relatif ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE contrat_principal ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE environemental ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE plan_environnemental ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE cahier_de_charge ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE projet_cahier_de_charge ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE amodiation ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE gisement ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE etat_financier ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE information_financiere ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE part_actionnaire ADD is_publish TINYINT(1) DEFAULT NULL;

CREATE TABLE image (id INT AUTO_INCREMENT NOT NULL, projet_dot_id INT DEFAULT NULL, projet_etd_id INT DEFAULT NULL, projet_cahier_de_charge_id INT DEFAULT NULL, user_id INT DEFAULT NULL, libelle VARCHAR(255) DEFAULT NULL, fichier VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_C53D045F663197CC (projet_dot_id), INDEX IDX_C53D045FEA44B565 (projet_etd_id), INDEX IDX_C53D045FD236555C (projet_cahier_de_charge_id), INDEX IDX_C53D045FA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE image ADD CONSTRAINT FK_C53D045F663197CC FOREIGN KEY (projet_dot_id) REFERENCES projet_dot (id);
ALTER TABLE image ADD CONSTRAINT FK_C53D045FEA44B565 FOREIGN KEY (projet_etd_id) REFERENCES projet_etd (id);
ALTER TABLE image ADD CONSTRAINT FK_C53D045FD236555C FOREIGN KEY (projet_cahier_de_charge_id) REFERENCES projet_cahier_de_charge (id);
ALTER TABLE image ADD CONSTRAINT FK_C53D045FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE dot ADD token VARCHAR(255) DEFAULT NULL, ADD domaine VARCHAR(255) DEFAULT NULL;
ALTER TABLE etd ADD token VARCHAR(255) DEFAULT NULL, ADD domaine VARCHAR(255) DEFAULT NULL;

ALTER TABLE comite_pilotage DROP FOREIGN KEY FK_1A25D289C8ED0533;
DROP INDEX IDX_1A25D289C8ED0533 ON comite_pilotage;
ALTER TABLE comite_pilotage DROP etd_id;

ALTER TABLE comite_pilotage ADD etd_id INT DEFAULT NULL;
ALTER TABLE comite_pilotage ADD CONSTRAINT FK_1A25D289C8ED0533 FOREIGN KEY (etd_id) REFERENCES etd (id);
CREATE INDEX IDX_1A25D289C8ED0533 ON comite_pilotage (etd_id);

CREATE TABLE comite_pilotage_dot (id INT AUTO_INCREMENT NOT NULL, dot_id INT DEFAULT NULL, arrete_id INT DEFAULT NULL, user_id INT DEFAULT NULL, membre_communaute_local1 VARCHAR(255) DEFAULT NULL, membre_communaute_local2 VARCHAR(255) DEFAULT NULL, membre_organisation_communautaire1 VARCHAR(255) DEFAULT NULL, membre_organisation_communautaire2 VARCHAR(255) DEFAULT NULL, membre_operateur1 VARCHAR(255) DEFAULT NULL, membre_operateur2 VARCHAR(255) DEFAULT NULL, membre_autorite1 VARCHAR(255) DEFAULT NULL, membre_autorite2 VARCHAR(255) DEFAULT NULL, membre_fonds_national1 VARCHAR(255) DEFAULT NULL, membre_fonds_national2 VARCHAR(255) DEFAULT NULL, membre_direction1 VARCHAR(255) DEFAULT NULL, membre_direction2 VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4334502B4498279A (dot_id), UNIQUE INDEX UNIQ_4334502BF9001553 (arrete_id), INDEX IDX_4334502BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE comite_pilotage_dot ADD CONSTRAINT FK_4334502B4498279A FOREIGN KEY (dot_id) REFERENCES dot (id);
ALTER TABLE comite_pilotage_dot ADD CONSTRAINT FK_4334502BF9001553 FOREIGN KEY (arrete_id) REFERENCES arrete (id);
ALTER TABLE comite_pilotage_dot ADD CONSTRAINT FK_4334502BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE comite_pilotage_dot DROP FOREIGN KEY FK_4334502BF9001553;
DROP INDEX UNIQ_4334502BF9001553 ON comite_pilotage_dot;
ALTER TABLE comite_pilotage_dot DROP arrete_id;

ALTER TABLE comite_pilotage_dot ADD arrete_id INT DEFAULT NULL;
ALTER TABLE comite_pilotage_dot ADD CONSTRAINT FK_4334502BF9001553 FOREIGN KEY (arrete_id) REFERENCES arrete (id);
CREATE UNIQUE INDEX UNIQ_4334502BF9001553 ON comite_pilotage_dot (arrete_id);

CREATE TABLE versement_dot (id INT AUTO_INCREMENT NOT NULL, information_financiere_id INT DEFAULT NULL, user_id INT DEFAULT NULL, montant NUMERIC(10, 2) DEFAULT NULL, date_versement DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_CD21AFC94852F072 (information_financiere_id), INDEX IDX_CD21AFC9A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE versement_dot ADD CONSTRAINT FK_CD21AFC94852F072 FOREIGN KEY (information_financiere_id) REFERENCES information_financiere (id);
ALTER TABLE versement_dot ADD CONSTRAINT FK_CD21AFC9A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE versement_redevance (id INT AUTO_INCREMENT NOT NULL, redevance_id INT DEFAULT NULL, user_id INT DEFAULT NULL, montant NUMERIC(10, 2) DEFAULT NULL, date_versement DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_411FC05462B5247D (redevance_id), INDEX IDX_411FC054A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE versement_redevance ADD CONSTRAINT FK_411FC05462B5247D FOREIGN KEY (redevance_id) REFERENCES redevance (id);
ALTER TABLE versement_redevance ADD CONSTRAINT FK_411FC054A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE versement_redevance ADD banque_debuter VARCHAR(255) DEFAULT NULL;
ALTER TABLE versement_dot ADD banque_debuter VARCHAR(255) DEFAULT NULL;

ALTER TABLE comite_pilotage_dot ADD date_nomination DATE DEFAULT NULL;
ALTER TABLE projet_dot ADD niveau_execution NUMERIC(10, 2) DEFAULT NULL, ADD approbation_ministre VARCHAR(255) DEFAULT NULL;


ALTER TABLE projet_dot ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE comite_pilotage_dot ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE versement_dot ADD is_publish TINYINT(1) DEFAULT NULL;

ALTER TABLE etd_secondaire ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE depense_etd ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE comite_pilotage ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE projet_etd ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE comite ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE versement_redevance ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE redevance ADD is_publish TINYINT(1) DEFAULT NULL;
*/

/*EXPLOITATION
ALTER TABLE ouverture_centre_recherche ADD projet_id INT DEFAULT NULL;
ALTER TABLE ouverture_centre_recherche ADD CONSTRAINT FK_D85B9FE3C18272 FOREIGN KEY (projet_id) REFERENCES projet (id);
CREATE UNIQUE INDEX UNIQ_D85B9FE3C18272 ON ouverture_centre_recherche (projet_id);

CREATE TABLE ouverture_centre_exportation (id INT AUTO_INCREMENT NOT NULL, operateur_id INT DEFAULT NULL, projet_id INT DEFAULT NULL, village_id INT DEFAULT NULL, user_id INT DEFAULT NULL, nom_centre VARCHAR(255) DEFAULT NULL, nom_chantier VARCHAR(255) DEFAULT NULL, nature_gisement VARCHAR(255) DEFAULT NULL, mois_annee VARCHAR(255) DEFAULT NULL, numero_avis_portant_approbation_eies VARCHAR(255) DEFAULT NULL, numero_recepisse_gouverneur VARCHAR(255) DEFAULT NULL, numero_autorisation_environnementale VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, proces_verbal_consultation_communaute_locale VARCHAR(255) DEFAULT NULL, date_approbation_declaration DATE DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_CB7570AA3F192FC (operateur_id), UNIQUE INDEX UNIQ_CB7570AAC18272 (projet_id), INDEX IDX_CB7570AA5E0D5582 (village_id), INDEX IDX_CB7570AAA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE ouverture_centre_exportation_commodite (ouverture_centre_exportation_id INT NOT NULL, commodite_id INT NOT NULL, INDEX IDX_6363DF6EBDFEE108 (ouverture_centre_exportation_id), INDEX IDX_6363DF6EAE632A35 (commodite_id), PRIMARY KEY(ouverture_centre_exportation_id, commodite_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE ouverture_centre_exportation_titre_minier (ouverture_centre_exportation_id INT NOT NULL, titre_minier_id INT NOT NULL, INDEX IDX_59273BC2BDFEE108 (ouverture_centre_exportation_id), INDEX IDX_59273BC23DC61AC6 (titre_minier_id), PRIMARY KEY(ouverture_centre_exportation_id, titre_minier_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE ouverture_centre_exportation ADD CONSTRAINT FK_CB7570AA3F192FC FOREIGN KEY (operateur_id) REFERENCES operateur (id);
ALTER TABLE ouverture_centre_exportation ADD CONSTRAINT FK_CB7570AAC18272 FOREIGN KEY (projet_id) REFERENCES projet (id);
ALTER TABLE ouverture_centre_exportation ADD CONSTRAINT FK_CB7570AA5E0D5582 FOREIGN KEY (village_id) REFERENCES village (id);
ALTER TABLE ouverture_centre_exportation ADD CONSTRAINT FK_CB7570AAA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE ouverture_centre_exportation_commodite ADD CONSTRAINT FK_6363DF6EBDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id) ON DELETE CASCADE;
ALTER TABLE ouverture_centre_exportation_commodite ADD CONSTRAINT FK_6363DF6EAE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id) ON DELETE CASCADE;
ALTER TABLE ouverture_centre_exportation_titre_minier ADD CONSTRAINT FK_59273BC2BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id) ON DELETE CASCADE;
ALTER TABLE ouverture_centre_exportation_titre_minier ADD CONSTRAINT FK_59273BC23DC61AC6 FOREIGN KEY (titre_minier_id) REFERENCES titre_minier (id) ON DELETE CASCADE;
ALTER TABLE surete_financiere ADD ouverture_centre_exportation_id INT DEFAULT NULL;
ALTER TABLE surete_financiere ADD CONSTRAINT FK_DCB64E92BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id);
CREATE INDEX IDX_DCB64E92BDFEE108 ON surete_financiere (ouverture_centre_exportation_id);
ALTER TABLE fond_topographique ADD ouverture_centre_exportation_id INT DEFAULT NULL;
ALTER TABLE fond_topographique ADD CONSTRAINT FK_40CBBDF7BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id);
CREATE INDEX IDX_40CBBDF7BDFEE108 ON fond_topographique (ouverture_centre_exportation_id);
ALTER TABLE plan_acces_site ADD ouverture_centre_exportation_id INT DEFAULT NULL;
ALTER TABLE plan_acces_site ADD CONSTRAINT FK_2D34B5D8BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id);
CREATE INDEX IDX_2D34B5D8BDFEE108 ON plan_acces_site (ouverture_centre_exportation_id);
ALTER TABLE ouverture_centre_exportation ADD date_declaration_ouverture DATE DEFAULT NULL;


CREATE TABLE ouverture_centre_exportation_methode_recherche (ouverture_centre_exportation_id INT NOT NULL, methode_recherche_id INT NOT NULL, INDEX IDX_57636B31BDFEE108 (ouverture_centre_exportation_id), INDEX IDX_57636B31A8616430 (methode_recherche_id), PRIMARY KEY(ouverture_centre_exportation_id, methode_recherche_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE ouverture_centre_exportation_methode_recherche ADD CONSTRAINT FK_57636B31BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id) ON DELETE CASCADE;
ALTER TABLE ouverture_centre_exportation_methode_recherche ADD CONSTRAINT FK_57636B31A8616430 FOREIGN KEY (methode_recherche_id) REFERENCES methode_recherche (id) ON DELETE CASCADE;


CREATE TABLE presence_exploitation (id INT AUTO_INCREMENT NOT NULL, agent_id INT DEFAULT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, absence_justifiee INT DEFAULT NULL, absence_non_justifiee INT DEFAULT NULL, taux_absenteisme DOUBLE PRECISION DEFAULT NULL, absence_cause_maladie INT DEFAULT NULL, conge_reconstitution INT DEFAULT NULL, conge_circonstance INT DEFAULT NULL, conge_en_cas_de_maladie INT DEFAULT NULL, maladies VARCHAR(255) DEFAULT NULL, circonstances VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mines NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, presences INT DEFAULT NULL, maladie_absence VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_815C29BC3414710B (agent_id), INDEX IDX_815C29BC99201C9B (centre_exploitation_id), INDEX IDX_815C29BCA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE presence_exploitation ADD CONSTRAINT FK_815C29BC3414710B FOREIGN KEY (agent_id) REFERENCES membre (id);
ALTER TABLE presence_exploitation ADD CONSTRAINT FK_815C29BC99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE presence_exploitation ADD CONSTRAINT FK_815C29BCA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);


CREATE TABLE echantillon_preleve_exploitation (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, pays_destination_id INT DEFAULT NULL, user_id INT DEFAULT NULL, orgine VARCHAR(255) DEFAULT NULL, type_ouvrage VARCHAR(255) DEFAULT NULL, lat NUMERIC(10, 2) DEFAULT NULL, lng NUMERIC(10, 2) DEFAULT NULL, date_de_prelevement DATE DEFAULT NULL, nombre_echantillon INT DEFAULT NULL, volume NUMERIC(10, 2) DEFAULT NULL, poid_echantillon NUMERIC(10, 2) DEFAULT NULL, caracteristiques LONGTEXT DEFAULT NULL, lieu_emission VARCHAR(255) DEFAULT NULL, numero_formulaire VARCHAR(255) DEFAULT NULL, date_expedition DATE DEFAULT NULL, nom_destinataire VARCHAR(255) DEFAULT NULL, adresse_destinateur VARCHAR(255) DEFAULT NULL, charges NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, recommadations_inspecteur_direction_geologie LONGTEXT DEFAULT NULL, cote_inspecteur_direction_geologie NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, devise VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_E7077EF999201C9B (centre_exploitation_id), INDEX IDX_E7077EF9D3356485 (pays_destination_id), INDEX IDX_E7077EF9A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE echantillon_preleve_exploitation_commodite (echantillon_preleve_exploitation_id INT NOT NULL, commodite_id INT NOT NULL, INDEX IDX_1FEAFCB2F38C4C53 (echantillon_preleve_exploitation_id), INDEX IDX_1FEAFCB2AE632A35 (commodite_id), PRIMARY KEY(echantillon_preleve_exploitation_id, commodite_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE echantillon_preleve_exploitation ADD CONSTRAINT FK_E7077EF999201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE echantillon_preleve_exploitation ADD CONSTRAINT FK_E7077EF9D3356485 FOREIGN KEY (pays_destination_id) REFERENCES pays (id);
ALTER TABLE echantillon_preleve_exploitation ADD CONSTRAINT FK_E7077EF9A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE echantillon_preleve_exploitation_commodite ADD CONSTRAINT FK_1FEAFCB2F38C4C53 FOREIGN KEY (echantillon_preleve_exploitation_id) REFERENCES echantillon_preleve_exploitation (id) ON DELETE CASCADE;
ALTER TABLE echantillon_preleve_exploitation_commodite ADD CONSTRAINT FK_1FEAFCB2AE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id) ON DELETE CASCADE;

CREATE TABLE fermeture_centre_exploitation (id INT AUTO_INCREMENT NOT NULL, surete_financiere_id INT DEFAULT NULL, user_id INT DEFAULT NULL, numero_avis_environnemental_approbation_eies VARCHAR(255) DEFAULT NULL, date_declaration_fermeture VARCHAR(255) DEFAULT NULL, moti_fermeture LONGTEXT DEFAULT NULL, numero_attestation_liberation_obligation_environnementale VARCHAR(255) DEFAULT NULL, date_approbation_declaration_fermeture DATE DEFAULT NULL, date_transmission_direction DATE DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, numero_autorisation_environnementale VARCHAR(255) DEFAULT NULL, proces_verbal_consultation_population_locale VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_A6AF6067D42EDD40 (surete_financiere_id), INDEX IDX_A6AF6067A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE fermeture_centre_exploitation ADD CONSTRAINT FK_A6AF6067D42EDD40 FOREIGN KEY (surete_financiere_id) REFERENCES surete_financiere (id);
ALTER TABLE fermeture_centre_exploitation ADD CONSTRAINT FK_A6AF6067A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE fermeture_centre_exploitation ADD centre_exploitation_id INT DEFAULT NULL;
ALTER TABLE fermeture_centre_exploitation ADD CONSTRAINT FK_A6AF606799201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
CREATE INDEX IDX_A6AF606799201C9B ON fermeture_centre_exploitation (centre_exploitation_id);

CREATE TABLE engin (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, type_engin VARCHAR(255) DEFAULT NULL, capacite_nominale_et_effective NUMERIC(10, 2) DEFAULT NULL, coefficient_de_mise_adisposition NUMERIC(10, 2) DEFAULT NULL, coefficient_dutilisation NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_1FA4CE04A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE travail (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, nom VARCHAR(255) DEFAULT NULL, categorie VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_90897ABBA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE travail_exploitation (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, travail_id INT DEFAULT NULL, user_id INT DEFAULT NULL, nombre_cadre_nationaux INT DEFAULT NULL, nombre_cadre_etranger INT DEFAULT NULL, nombre_agent_maitrise_nationaux INT DEFAULT NULL, nombre_agent_maitrise_etranger INT DEFAULT NULL, prevision NUMERIC(10, 2) DEFAULT NULL, realisation NUMERIC(10, 2) DEFAULT NULL, ecart NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_121030E599201C9B (centre_exploitation_id), INDEX IDX_121030E5EEFE7EA9 (travail_id), INDEX IDX_121030E5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE travail_exploitation_engin (travail_exploitation_id INT NOT NULL, engin_id INT NOT NULL, INDEX IDX_3D8F30AEB99F1FE (travail_exploitation_id), INDEX IDX_3D8F30AEE58AF0C2 (engin_id), PRIMARY KEY(travail_exploitation_id, engin_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE travail_exploitation_membre (travail_exploitation_id INT NOT NULL, membre_id INT NOT NULL, INDEX IDX_C0959A21B99F1FE (travail_exploitation_id), INDEX IDX_C0959A216A99F74A (membre_id), PRIMARY KEY(travail_exploitation_id, membre_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE engin ADD CONSTRAINT FK_1FA4CE04A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE travail ADD CONSTRAINT FK_90897ABBA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE travail_exploitation ADD CONSTRAINT FK_121030E599201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE travail_exploitation ADD CONSTRAINT FK_121030E5EEFE7EA9 FOREIGN KEY (travail_id) REFERENCES travail (id);
ALTER TABLE travail_exploitation ADD CONSTRAINT FK_121030E5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE travail_exploitation_engin ADD CONSTRAINT FK_3D8F30AEB99F1FE FOREIGN KEY (travail_exploitation_id) REFERENCES travail_exploitation (id) ON DELETE CASCADE;
ALTER TABLE travail_exploitation_engin ADD CONSTRAINT FK_3D8F30AEE58AF0C2 FOREIGN KEY (engin_id) REFERENCES engin (id) ON DELETE CASCADE;
ALTER TABLE travail_exploitation_membre ADD CONSTRAINT FK_C0959A21B99F1FE FOREIGN KEY (travail_exploitation_id) REFERENCES travail_exploitation (id) ON DELETE CASCADE;
ALTER TABLE travail_exploitation_membre ADD CONSTRAINT FK_C0959A216A99F74A FOREIGN KEY (membre_id) REFERENCES membre (id) ON DELETE CASCADE;

ALTER TABLE travail_exploitation ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;

CREATE TABLE cotation (id INT AUTO_INCREMENT NOT NULL, travail_id INT DEFAULT NULL, plan_topographique_vertical_horizontal_travaux_souterrains_id INT DEFAULT NULL, user_id INT DEFAULT NULL, echelle NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_996DA944EEFE7EA9 (travail_id), INDEX IDX_996DA94456B88BC8 (plan_topographique_vertical_horizontal_travaux_souterrains_id), INDEX IDX_996DA944A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE plan_topographique_vertical_horizontal_travaux_souterrains (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_C9AFBA899201C9B (centre_exploitation_id), INDEX IDX_C9AFBA8A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE cotation ADD CONSTRAINT FK_996DA944EEFE7EA9 FOREIGN KEY (travail_id) REFERENCES travail (id);
ALTER TABLE cotation ADD CONSTRAINT FK_996DA94456B88BC8 FOREIGN KEY (plan_topographique_vertical_horizontal_travaux_souterrains_id) REFERENCES plan_topographique_vertical_horizontal_travaux_souterrains (id);
ALTER TABLE cotation ADD CONSTRAINT FK_996DA944A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE plan_topographique_vertical_horizontal_travaux_souterrains ADD CONSTRAINT FK_C9AFBA899201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE plan_topographique_vertical_horizontal_travaux_souterrains ADD CONSTRAINT FK_C9AFBA8A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE travail_exploitation ADD type_mine VARCHAR(255) DEFAULT NULL;
ALTER TABLE plan_topographique_vertical_horizontal_travaux_souterrains ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;

CREATE TABLE fait_important_relatif_au_travail_souterrain (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, date_fait DATE DEFAULT NULL, localisation_des_travaux VARCHAR(255) DEFAULT NULL, amenagement LONGTEXT DEFAULT NULL, execution LONGTEXT DEFAULT NULL, avancement LONGTEXT DEFAULT NULL, renforcement LONGTEXT DEFAULT NULL, description_des_evenements LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, carte VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_660CD12399201C9B (centre_exploitation_id), INDEX IDX_660CD123A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE fait_important_relatif_au_travail_souterrain ADD CONSTRAINT FK_660CD12399201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE fait_important_relatif_au_travail_souterrain ADD CONSTRAINT FK_660CD123A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE nature_travail (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, nom VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_880A316EA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE plan_occupation_de_la_surfaceselon_nature_des_travaux (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_266BEA1799201C9B (centre_exploitation_id), INDEX IDX_266BEA17A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE cotation_nature_travail (id INT AUTO_INCREMENT NOT NULL, nature_travail_id INT DEFAULT NULL, plan_occupation_de_la_surfaceselon_nature_des_travaux_id INT DEFAULT NULL, user_id INT DEFAULT NULL, echelle NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4C1C1828280CD3E (nature_travail_id), INDEX IDX_4C1C18281D9D355 (plan_occupation_de_la_surfaceselon_nature_des_travaux_id), INDEX IDX_4C1C1828A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE nature_travail ADD CONSTRAINT FK_880A316EA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE plan_occupation_de_la_surfaceselon_nature_des_travaux ADD CONSTRAINT FK_266BEA1799201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE plan_occupation_de_la_surfaceselon_nature_des_travaux ADD CONSTRAINT FK_266BEA17A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE cotation_nature_travail ADD CONSTRAINT FK_4C1C1828280CD3E FOREIGN KEY (nature_travail_id) REFERENCES nature_travail (id);
ALTER TABLE cotation_nature_travail ADD CONSTRAINT FK_4C1C18281D9D355 FOREIGN KEY (plan_occupation_de_la_surfaceselon_nature_des_travaux_id) REFERENCES plan_occupation_de_la_surfaceselon_nature_des_travaux (id);
ALTER TABLE cotation_nature_travail ADD CONSTRAINT FK_4C1C1828A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE chantier_exploitation (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_accident DATE DEFAULT NULL, lieu_accident VARCHAR(255) DEFAULT NULL, description_accident LONGTEXT DEFAULT NULL, nature_accident VARCHAR(255) DEFAULT NULL, cause_accident VARCHAR(255) DEFAULT NULL, nombre_de_jour_perdu INT DEFAULT NULL, date_inspectionadministrative DATE DEFAULT NULL, service_inspection_administrative VARCHAR(255) DEFAULT NULL, objet_inspection_administrative VARCHAR(255) DEFAULT NULL, visiteurs VARCHAR(255) DEFAULT NULL, date_visite DATE DEFAULT NULL, objet_visite VARCHAR(255) DEFAULT NULL, description_visite LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, cote_inspecteur_direction_carriere NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_carriere NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_7E9EC4AC99201C9B (centre_exploitation_id), INDEX IDX_7E9EC4ACA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE chantier_exploitation ADD CONSTRAINT FK_7E9EC4AC99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE chantier_exploitation ADD CONSTRAINT FK_7E9EC4ACA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE extraction_miniere (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, commodite_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_extraction DATE DEFAULT NULL, teneur_du_minerai_en_place NUMERIC(10, 2) DEFAULT NULL, teneur_de_coupure NUMERIC(10, 2) DEFAULT NULL, cubage_extrait_minerai NUMERIC(10, 2) DEFAULT NULL, cubage_extrait_sterile NUMERIC(10, 2) DEFAULT NULL, cubage_charge_minerai NUMERIC(10, 2) DEFAULT NULL, cubage_charge_sterile NUMERIC(10, 2) DEFAULT NULL, cubage_restant_minerai NUMERIC(10, 2) DEFAULT NULL, cubage_restant_sterile NUMERIC(10, 2) DEFAULT NULL, stock_dans_le_silo_debut_mois_minerai NUMERIC(10, 2) DEFAULT NULL, stock_dans_le_silo_fin_du_mois_sterile NUMERIC(10, 2) DEFAULT NULL, dilution NUMERIC(10, 2) DEFAULT NULL, taux_salissage NUMERIC(10, 2) DEFAULT NULL, perte NUMERIC(10, 2) DEFAULT NULL, taux_recuperation NUMERIC(10, 2) DEFAULT NULL, taux_de_defruitement NUMERIC(10, 2) DEFAULT NULL, production NUMERIC(10, 2) DEFAULT NULL, productivite NUMERIC(10, 2) DEFAULT NULL, stock_dans_laccumilateur NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_1E0DD89699201C9B (centre_exploitation_id), INDEX IDX_1E0DD896AE632A35 (commodite_id), INDEX IDX_1E0DD896A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE extraction_miniere ADD CONSTRAINT FK_1E0DD89699201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE extraction_miniere ADD CONSTRAINT FK_1E0DD896AE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id);
ALTER TABLE extraction_miniere ADD CONSTRAINT FK_1E0DD896A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE extraction_produit_carriere (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, commodite_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_extraction DATE DEFAULT NULL, teneur_du_minerai_en_place NUMERIC(10, 2) DEFAULT NULL, teneur_de_coupure NUMERIC(10, 2) DEFAULT NULL, cubage_extrait_minerai NUMERIC(10, 2) DEFAULT NULL, cubage_extrait_sterile NUMERIC(10, 2) DEFAULT NULL, cubage_charge_minerai NUMERIC(10, 2) DEFAULT NULL, cubage_charge_sterile NUMERIC(10, 2) DEFAULT NULL, cubage_restant_minerai NUMERIC(10, 2) DEFAULT NULL, cubage_restant_sterile NUMERIC(10, 2) DEFAULT NULL, stock_dans_le_silo_debut_mois_minerai NUMERIC(10, 2) DEFAULT NULL, stock_dans_le_silo_debut_mois_sterile NUMERIC(10, 2) DEFAULT NULL, stock_dans_le_silo_fin_du_mois_sterile NUMERIC(10, 2) DEFAULT NULL, dilution NUMERIC(10, 2) DEFAULT NULL, taux_salissage NUMERIC(10, 2) DEFAULT NULL, perte NUMERIC(10, 2) DEFAULT NULL, taux_recuperation NUMERIC(10, 2) DEFAULT NULL, taux_de_defruitement NUMERIC(10, 2) DEFAULT NULL, production NUMERIC(10, 2) DEFAULT NULL, productivite NUMERIC(10, 2) DEFAULT NULL, stock_dans_laccumilateur NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_75B8E6999201C9B (centre_exploitation_id), INDEX IDX_75B8E69AE632A35 (commodite_id), INDEX IDX_75B8E69A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE extraction_produit_carriere ADD CONSTRAINT FK_75B8E6999201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE extraction_produit_carriere ADD CONSTRAINT FK_75B8E69AE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id);
ALTER TABLE extraction_produit_carriere ADD CONSTRAINT FK_75B8E69A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE extraction_mineralurgique_et_metallurgique (id INT AUTO_INCREMENT NOT NULL, commodite_id INT DEFAULT NULL, centre_exploitation_id INT DEFAULT NULL, date_extraction DATE DEFAULT NULL, tonnage_alimente NUMERIC(10, 2) DEFAULT NULL, tonnage_al_alimentation NUMERIC(10, 2) DEFAULT NULL, tonnage_traite NUMERIC(10, 2) DEFAULT NULL, poids_du_concentre_de_la_substance_recuperee NUMERIC(10, 2) DEFAULT NULL, poid_du_metal NUMERIC(10, 2) DEFAULT NULL, teneur_des_rejets NUMERIC(10, 2) DEFAULT NULL, perte_metal NUMERIC(10, 2) DEFAULT NULL, rendement_des_traitements NUMERIC(10, 2) DEFAULT NULL, teneur_en_impuretes_nuisibles NUMERIC(10, 2) DEFAULT NULL, teneur_en_element_associe_valorisable NUMERIC(10, 2) DEFAULT NULL, situation_des_stock_des_concentres_au_premier_du_mois NUMERIC(10, 2) DEFAULT NULL, situation_des_stock_des_concentres_ala_fin_du_mois NUMERIC(10, 2) DEFAULT NULL, heure_de_marche DATETIME DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, type_extraction VARCHAR(255) DEFAULT NULL, INDEX IDX_8EA2120BAE632A35 (commodite_id), INDEX IDX_8EA2120B99201C9B (centre_exploitation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE extraction_mineralurgique_et_metallurgique ADD CONSTRAINT FK_8EA2120BAE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id);
ALTER TABLE extraction_mineralurgique_et_metallurgique ADD CONSTRAINT FK_8EA2120B99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);

ALTER TABLE extraction_mineralurgique_et_metallurgique ADD user_id INT DEFAULT NULL, ADD created_at DATETIME DEFAULT NULL, ADD updated_at DATETIME DEFAULT NULL, ADD deleted_at DATETIME DEFAULT NULL;
ALTER TABLE extraction_mineralurgique_et_metallurgique ADD CONSTRAINT FK_8EA2120BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
CREATE INDEX IDX_8EA2120BA76ED395 ON extraction_mineralurgique_et_metallurgique (user_id);

ALTER TABLE extraction_mineralurgique_et_metallurgique ADD teneur_du_concentre_recupere NUMERIC(10, 2) DEFAULT NULL;

ALTER TABLE extraction_mineralurgique_et_metallurgique ADD provenance_id INT DEFAULT NULL;
ALTER TABLE extraction_mineralurgique_et_metallurgique ADD CONSTRAINT FK_8EA2120BC24AFBDB FOREIGN KEY (provenance_id) REFERENCES province (id);
CREATE INDEX IDX_8EA2120BC24AFBDB ON extraction_mineralurgique_et_metallurgique (provenance_id);

CREATE TABLE traitement_metallurgique (id INT AUTO_INCREMENT NOT NULL, commodite_id INT DEFAULT NULL, centre_exploitation_id INT DEFAULT NULL, provenance_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_extraction DATE DEFAULT NULL, tonnage_alimente NUMERIC(10, 2) DEFAULT NULL, teneur_al_alimentation NUMERIC(10, 2) DEFAULT NULL, tonnage_traite NUMERIC(10, 2) DEFAULT NULL, poids_du_metal_recupere NUMERIC(10, 2) DEFAULT NULL, teneur_du_metal_recupere NUMERIC(10, 2) DEFAULT NULL, format_du_produit_marchand VARCHAR(255) DEFAULT NULL, teneur_des_rejets NUMERIC(10, 2) DEFAULT NULL, perte_metal NUMERIC(10, 2) DEFAULT NULL, rendement_des_traitements NUMERIC(10, 2) DEFAULT NULL, teneur_en_impuretes NUMERIC(10, 2) DEFAULT NULL, teneur_en_element_associes NUMERIC(10, 2) DEFAULT NULL, situation_des_stock_au_premier_du_mois NUMERIC(10, 2) DEFAULT NULL, situation_des_stock_en_fin_du_mois NUMERIC(10, 2) DEFAULT NULL, date_et_heure_de_marche DATETIME DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_B22D8A01AE632A35 (commodite_id), INDEX IDX_B22D8A0199201C9B (centre_exploitation_id), INDEX IDX_B22D8A01C24AFBDB (provenance_id), INDEX IDX_B22D8A01A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE traitement_metallurgique ADD CONSTRAINT FK_B22D8A01AE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id);
ALTER TABLE traitement_metallurgique ADD CONSTRAINT FK_B22D8A0199201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE traitement_metallurgique ADD CONSTRAINT FK_B22D8A01C24AFBDB FOREIGN KEY (provenance_id) REFERENCES province (id);
ALTER TABLE traitement_metallurgique ADD CONSTRAINT FK_B22D8A01A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE journal_de_transformation (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, commodite_id INT DEFAULT NULL, orgine_locale_id INT DEFAULT NULL, orgine_etrangere_id INT DEFAULT NULL, fournisseur_id INT DEFAULT NULL, intrant_id INT DEFAULT NULL, orgine_intrant_id INT DEFAULT NULL, user_id INT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, numero_ordre VARCHAR(255) DEFAULT NULL, nature_produit VARCHAR(255) DEFAULT NULL, quantite_produit NUMERIC(10, 2) DEFAULT NULL, valeur_produit NUMERIC(10, 2) DEFAULT NULL, nature_intrant VARCHAR(255) DEFAULT NULL, quantite_intrant NUMERIC(10, 2) DEFAULT NULL, valeur_intrant NUMERIC(10, 2) DEFAULT NULL, nature_produit_fini VARCHAR(255) DEFAULT NULL, quantite_produit_fini NUMERIC(10, 2) DEFAULT NULL, valeur_produit_fini NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_94C6421499201C9B (centre_exploitation_id), INDEX IDX_94C64214AE632A35 (commodite_id), INDEX IDX_94C642143E13AC5C (orgine_locale_id), INDEX IDX_94C64214822EC040 (orgine_etrangere_id), INDEX IDX_94C64214670C757F (fournisseur_id), INDEX IDX_94C6421491C37DA8 (intrant_id), INDEX IDX_94C64214211C846 (orgine_intrant_id), INDEX IDX_94C64214A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C6421499201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C64214AE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id);
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C642143E13AC5C FOREIGN KEY (orgine_locale_id) REFERENCES province (id);
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C64214822EC040 FOREIGN KEY (orgine_etrangere_id) REFERENCES pays (id);
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C64214670C757F FOREIGN KEY (fournisseur_id) REFERENCES operateur (id);
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C6421491C37DA8 FOREIGN KEY (intrant_id) REFERENCES intrant (id);
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C64214211C846 FOREIGN KEY (orgine_intrant_id) REFERENCES pays (id);
ALTER TABLE journal_de_transformation ADD CONSTRAINT FK_94C64214A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE controle_de_stabilite_des_ouvrage (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, date_visite DATE DEFAULT NULL, nature_ouvrage VARCHAR(255) DEFAULT NULL, annee_de_contruction VARCHAR(255) DEFAULT NULL, etat_ouvrage_deniere_visite VARCHAR(255) DEFAULT NULL, evenement_eventuellement_survenu VARCHAR(255) DEFAULT NULL, travaux_effectues VARCHAR(255) DEFAULT NULL, etat_actuel_ouvrage VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_70065B2E99201C9B (centre_exploitation_id), INDEX IDX_70065B2EA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE controle_de_stabilite_des_ouvrage ADD CONSTRAINT FK_70065B2E99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE controle_de_stabilite_des_ouvrage ADD CONSTRAINT FK_70065B2EA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE registre_de_surete_financiere_exploitation (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, type_operation VARCHAR(255) DEFAULT NULL, duree_du_projet INT DEFAULT NULL, exercice_au_cours VARCHAR(255) DEFAULT NULL, montant_prevu NUMERIC(10, 2) DEFAULT NULL, numero_bordereau VARCHAR(255) DEFAULT NULL, date_de_bordereau_de_versement DATE DEFAULT NULL, echeanciers DATE DEFAULT NULL, releve_trimestriel VARCHAR(255) DEFAULT NULL, montant_verse NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, paraphe_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_6CEB713C99201C9B (centre_exploitation_id), INDEX IDX_6CEB713CA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE registre_de_surete_financiere_exploitation ADD CONSTRAINT FK_6CEB713C99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE registre_de_surete_financiere_exploitation ADD CONSTRAINT FK_6CEB713CA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE registre_de_surete_financiere_exploitation ADD devise VARCHAR(255) DEFAULT NULL;
ALTER TABLE registre_de_surete_financiere_exploitation ADD devise_montant_verse VARCHAR(255) DEFAULT NULL;

CREATE TABLE mandataire_etat (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, nom VARCHAR(255) DEFAULT NULL, prenom VARCHAR(255) DEFAULT NULL, postnom VARCHAR(255) DEFAULT NULL, fonction VARCHAR(255) DEFAULT NULL, telephone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_A037B62CA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE nomination_mandataire_etat (id INT AUTO_INCREMENT NOT NULL, operateur_id INT DEFAULT NULL, arrete_id INT DEFAULT NULL, mandataire_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_nomination DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4ADF14423F192FC (operateur_id), UNIQUE INDEX UNIQ_4ADF1442F9001553 (arrete_id), INDEX IDX_4ADF144258207E03 (mandataire_id), INDEX IDX_4ADF1442A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE mandataire_etat ADD CONSTRAINT FK_A037B62CA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE nomination_mandataire_etat ADD CONSTRAINT FK_4ADF14423F192FC FOREIGN KEY (operateur_id) REFERENCES operateur (id);
ALTER TABLE nomination_mandataire_etat ADD CONSTRAINT FK_4ADF1442F9001553 FOREIGN KEY (arrete_id) REFERENCES arrete (id);
ALTER TABLE nomination_mandataire_etat ADD CONSTRAINT FK_4ADF144258207E03 FOREIGN KEY (mandataire_id) REFERENCES mandataire_etat (id);
ALTER TABLE nomination_mandataire_etat ADD CONSTRAINT FK_4ADF1442A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE mandataire_etat ADD is_publish TINYINT(1) DEFAULT NULL;
ALTER TABLE operateur ADD date_debut_production DATE DEFAULT NULL;

CREATE TABLE engagement_et_obligation (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, libelle VARCHAR(255) DEFAULT NULL, cout NUMERIC(10, 2) DEFAULT NULL, programme LONGTEXT DEFAULT NULL, modalites_executions LONGTEXT DEFAULT NULL, realisations LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_C1E5C99201C9B (centre_exploitation_id), INDEX IDX_C1E5CA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE engagement_et_obligation ADD CONSTRAINT FK_C1E5C99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE engagement_et_obligation ADD CONSTRAINT FK_C1E5CA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE engagement_et_obligation ADD observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL;

CREATE TABLE travaux_plan_attenuation_et_reabilitation (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, travaux_realises_en_execution LONGTEXT DEFAULT NULL, etat_avancement LONGTEXT DEFAULT NULL, resultats_obtenus LONGTEXT DEFAULT NULL, frais_engages NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_A62184B899201C9B (centre_exploitation_id), INDEX IDX_A62184B8A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE travaux_plan_attenuation_et_reabilitation ADD CONSTRAINT FK_A62184B899201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE travaux_plan_attenuation_et_reabilitation ADD CONSTRAINT FK_A62184B8A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE travaux_etude_imapct_environnemental_et_social (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, travaux_realises_en_execution LONGTEXT DEFAULT NULL, etat_avancement LONGTEXT DEFAULT NULL, resultats_obtenus LONGTEXT DEFAULT NULL, frais_engages NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4B485E3C99201C9B (centre_exploitation_id), INDEX IDX_4B485E3CA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE travaux_etude_imapct_environnemental_et_social ADD CONSTRAINT FK_4B485E3C99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE travaux_etude_imapct_environnemental_et_social ADD CONSTRAINT FK_4B485E3CA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE impact_environnemental_activite_miniere (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, observations LONGTEXT DEFAULT NULL, composante_systeme_environnemental VARCHAR(255) DEFAULT NULL, source_impact LONGTEXT DEFAULT NULL, impact_possible LONGTEXT DEFAULT NULL, mesure_attenuation LONGTEXT DEFAULT NULL, resultat_attendu LONGTEXT DEFAULT NULL, resultat_obtenu LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_546A8C5A99201C9B (centre_exploitation_id), INDEX IDX_546A8C5AA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE impact_environnemental_activite_miniere ADD CONSTRAINT FK_546A8C5A99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE impact_environnemental_activite_miniere ADD CONSTRAINT FK_546A8C5AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE contrat_relatif_operateur (contrat_relatif_id INT NOT NULL, operateur_id INT NOT NULL, INDEX IDX_4C871A1293AD10E0 (contrat_relatif_id), INDEX IDX_4C871A123F192FC (operateur_id), PRIMARY KEY(contrat_relatif_id, operateur_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE contrat_principal_operateur (contrat_principal_id INT NOT NULL, operateur_id INT NOT NULL, INDEX IDX_59149DE0C967927 (contrat_principal_id), INDEX IDX_59149DE03F192FC (operateur_id), PRIMARY KEY(contrat_principal_id, operateur_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE contrat_relatif_operateur ADD CONSTRAINT FK_4C871A1293AD10E0 FOREIGN KEY (contrat_relatif_id) REFERENCES contrat_relatif (id) ON DELETE CASCADE;
ALTER TABLE contrat_relatif_operateur ADD CONSTRAINT FK_4C871A123F192FC FOREIGN KEY (operateur_id) REFERENCES operateur (id) ON DELETE CASCADE;
ALTER TABLE contrat_principal_operateur ADD CONSTRAINT FK_59149DE0C967927 FOREIGN KEY (contrat_principal_id) REFERENCES contrat_principal (id) ON DELETE CASCADE;
ALTER TABLE contrat_principal_operateur ADD CONSTRAINT FK_59149DE03F192FC FOREIGN KEY (operateur_id) REFERENCES operateur (id) ON DELETE CASCADE;

#### PRECEDENT ###

CREATE TABLE auto_surveillance_contaminant (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, source_productrice VARCHAR(255) DEFAULT NULL, intensite_vibration NUMERIC(10, 2) DEFAULT NULL, unite_intensite_vibration VARCHAR(255) DEFAULT NULL, localisation_point_surveillance VARCHAR(255) DEFAULT NULL, intensite_bruit NUMERIC(10, 2) DEFAULT NULL, unite_intesite_bruit VARCHAR(255) DEFAULT NULL, localisation_point_surveillance_bruit VARCHAR(255) DEFAULT NULL, nature_contaminant VARCHAR(255) DEFAULT NULL, mesureprise_contaminant LONGTEXT DEFAULT NULL, localisation_point_mesure_contaminant VARCHAR(255) DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4FF832A999201C9B (centre_exploitation_id), INDEX IDX_4FF832A9A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE auto_surveillance_contaminant ADD CONSTRAINT FK_4FF832A999201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE auto_surveillance_contaminant ADD CONSTRAINT FK_4FF832A9A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE mesure_debit_et_ph_effluent (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, numero_effluent VARCHAR(255) DEFAULT NULL, nature_effluent VARCHAR(255) DEFAULT NULL, lieu_point_de_mesure VARCHAR(255) DEFAULT NULL, latitude_point_de_mesure NUMERIC(10, 2) DEFAULT NULL, longitude NUMERIC(10, 2) DEFAULT NULL, date_heure_prise_de_mesure DATETIME DEFAULT NULL, debit NUMERIC(10, 2) DEFAULT NULL, ph NUMERIC(10, 2) DEFAULT NULL, temperature NUMERIC(10, 2) DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_83E8F95B99201C9B (centre_exploitation_id), INDEX IDX_83E8F95BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE mesure_debit_et_ph_effluent ADD CONSTRAINT FK_83E8F95B99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE mesure_debit_et_ph_effluent ADD CONSTRAINT FK_83E8F95BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE pollution_air_au_sein_du_perimetre (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, nature_contaminant VARCHAR(255) DEFAULT NULL, date_heure_de_prise_de_mesure DATETIME DEFAULT NULL, mesure_prise NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4355222A99201C9B (centre_exploitation_id), INDEX IDX_4355222AA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE pollution_air_au_sein_du_perimetre ADD CONSTRAINT FK_4355222A99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE pollution_air_au_sein_du_perimetre ADD CONSTRAINT FK_4355222AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE pollution_air_exterieur_du_perimetre (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, nature_contaminant VARCHAR(255) DEFAULT NULL, date_heure_de_prise_de_mesure DATETIME DEFAULT NULL, mesure_prise NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_AD44BE0299201C9B (centre_exploitation_id), INDEX IDX_AD44BE02A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE pollution_air_exterieur_du_perimetre ADD CONSTRAINT FK_AD44BE0299201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE pollution_air_exterieur_du_perimetre ADD CONSTRAINT FK_AD44BE02A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE suivi_concentration_contaminant_dans_eau (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, nature_contaminant VARCHAR(255) DEFAULT NULL, date_heure_de_prise_de_mesure DATETIME DEFAULT NULL, mesure_prise NUMERIC(10, 2) DEFAULT NULL, ph_mesure NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4E64C3E999201C9B (centre_exploitation_id), INDEX IDX_4E64C3E9A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE suivi_concentration_contaminant_dans_eau ADD CONSTRAINT FK_4E64C3E999201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE suivi_concentration_contaminant_dans_eau ADD CONSTRAINT FK_4E64C3E9A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE suivi_engagement_contenu_dans_cahier_des_charges (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_approbation_cahier_de_charge DATE DEFAULT NULL, type_engagement VARCHAR(255) DEFAULT NULL, niveau_realisation_travaux VARCHAR(255) DEFAULT NULL, cout_travaux_realises NUMERIC(10, 2) DEFAULT NULL, devise_cout VARCHAR(255) DEFAULT NULL, date_reception_ouvrage DATE DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, proces_verbal_reception_cahier_de_charge VARCHAR(255) DEFAULT NULL, approbation_cahier_charge VARCHAR(255) DEFAULT NULL, proces_verbal_reception_ouvrage_et_action VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_F2426CEC99201C9B (centre_exploitation_id), INDEX IDX_F2426CECA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE suivi_engagement_contenu_dans_cahier_des_charges ADD CONSTRAINT FK_F2426CEC99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE suivi_engagement_contenu_dans_cahier_des_charges ADD CONSTRAINT FK_F2426CECA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE image ADD suivi_engagement_contenu_dans_cahier_des_charges_id INT DEFAULT NULL;
ALTER TABLE image ADD CONSTRAINT FK_C53D045F9723E811 FOREIGN KEY (suivi_engagement_contenu_dans_cahier_des_charges_id) REFERENCES suivi_engagement_contenu_dans_cahier_des_charges (id);
CREATE INDEX IDX_C53D045F9723E811 ON image (suivi_engagement_contenu_dans_cahier_des_charges_id);

CREATE TABLE suivi_des_rejet_miner_concentration_metal (id INT AUTO_INCREMENT NOT NULL, nature_metal_id INT DEFAULT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, latitude_station NUMERIC(10, 2) DEFAULT NULL, longitude_station NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, methode_de_mesure_utilisee VARCHAR(255) DEFAULT NULL, mesure_prise LONGTEXT DEFAULT NULL, date_heure_de_prise_de_mesure DATETIME DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_558693CDDDF2E9E2 (nature_metal_id), INDEX IDX_558693CD99201C9B (centre_exploitation_id), INDEX IDX_558693CDA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE suivi_des_rejet_miner_concentration_metal ADD CONSTRAINT FK_558693CDDDF2E9E2 FOREIGN KEY (nature_metal_id) REFERENCES commodite (id);
ALTER TABLE suivi_des_rejet_miner_concentration_metal ADD CONSTRAINT FK_558693CD99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE suivi_des_rejet_miner_concentration_metal ADD CONSTRAINT FK_558693CDA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE image ADD suivi_des_rejet_miner_concentration_metal_id INT DEFAULT NULL;
ALTER TABLE image ADD CONSTRAINT FK_C53D045FA1813FBA FOREIGN KEY (suivi_des_rejet_miner_concentration_metal_id) REFERENCES suivi_des_rejet_miner_concentration_metal (id);
CREATE INDEX IDX_C53D045FA1813FBA ON image (suivi_des_rejet_miner_concentration_metal_id);
ALTER TABLE fond_topographique ADD suivi_des_rejet_miner_concentration_metal_id INT DEFAULT NULL;
ALTER TABLE fond_topographique ADD CONSTRAINT FK_40CBBDF7A1813FBA FOREIGN KEY (suivi_des_rejet_miner_concentration_metal_id) REFERENCES suivi_des_rejet_miner_concentration_metal (id);
CREATE INDEX IDX_40CBBDF7A1813FBA ON fond_topographique (suivi_des_rejet_miner_concentration_metal_id);
ALTER TABLE plan_acces_site ADD suivi_des_rejet_miner_concentration_metal_id INT DEFAULT NULL;
ALTER TABLE plan_acces_site ADD CONSTRAINT FK_2D34B5D8A1813FBA FOREIGN KEY (suivi_des_rejet_miner_concentration_metal_id) REFERENCES suivi_des_rejet_miner_concentration_metal (id);
CREATE INDEX IDX_2D34B5D8A1813FBA ON plan_acces_site (suivi_des_rejet_miner_concentration_metal_id);

CREATE TABLE suivi_rejet_minier_concentration_en_compose (id INT AUTO_INCREMENT NOT NULL, nature_metal_id INT DEFAULT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, longitude_station NUMERIC(10, 2) DEFAULT NULL, latitude_station NUMERIC(10, 2) DEFAULT NULL, methode_de_mesure_utilisee VARCHAR(255) DEFAULT NULL, mesure_prise LONGTEXT DEFAULT NULL, date_heure_de_prise_de_mesure DATETIME DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_6D0EBE58DDF2E9E2 (nature_metal_id), INDEX IDX_6D0EBE5899201C9B (centre_exploitation_id), INDEX IDX_6D0EBE58A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE suivi_rejet_minier_concentration_en_compose ADD CONSTRAINT FK_6D0EBE58DDF2E9E2 FOREIGN KEY (nature_metal_id) REFERENCES commodite (id);
ALTER TABLE suivi_rejet_minier_concentration_en_compose ADD CONSTRAINT FK_6D0EBE5899201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE suivi_rejet_minier_concentration_en_compose ADD CONSTRAINT FK_6D0EBE58A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE image ADD suivi_rejet_minier_concentration_en_compose_id INT DEFAULT NULL;
ALTER TABLE image ADD CONSTRAINT FK_C53D045F99101464 FOREIGN KEY (suivi_rejet_minier_concentration_en_compose_id) REFERENCES suivi_rejet_minier_concentration_en_compose (id);
CREATE INDEX IDX_C53D045F99101464 ON image (suivi_rejet_minier_concentration_en_compose_id);
ALTER TABLE fond_topographique ADD suivi_rejet_minier_concentration_en_compose_id INT DEFAULT NULL;
ALTER TABLE fond_topographique ADD CONSTRAINT FK_40CBBDF799101464 FOREIGN KEY (suivi_rejet_minier_concentration_en_compose_id) REFERENCES suivi_rejet_minier_concentration_en_compose (id);
CREATE INDEX IDX_40CBBDF799101464 ON fond_topographique (suivi_rejet_minier_concentration_en_compose_id);
ALTER TABLE plan_acces_site ADD suivi_rejet_minier_concentration_en_compose_id INT DEFAULT NULL;
ALTER TABLE plan_acces_site ADD CONSTRAINT FK_2D34B5D899101464 FOREIGN KEY (suivi_rejet_minier_concentration_en_compose_id) REFERENCES suivi_rejet_minier_concentration_en_compose (id);
CREATE INDEX IDX_2D34B5D899101464 ON plan_acces_site (suivi_rejet_minier_concentration_en_compose_id);

CREATE TABLE suivi_piezometrie_consommation_en_eau (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, longitude_station NUMERIC(10, 2) DEFAULT NULL, latitude_station NUMERIC(10, 2) DEFAULT NULL, nom_puit_pompage VARCHAR(255) DEFAULT NULL, capacite_pompe NUMERIC(10, 2) DEFAULT NULL, unite_capacite_pompe NUMERIC(10, 2) DEFAULT NULL, volume_pompe NUMERIC(10, 2) NOT NULL, unite_volume_pompe VARCHAR(255) DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_62D1DA5099201C9B (centre_exploitation_id), INDEX IDX_62D1DA50A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE suivi_piezometrie_consommation_en_eau ADD CONSTRAINT FK_62D1DA5099201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE suivi_piezometrie_consommation_en_eau ADD CONSTRAINT FK_62D1DA50A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE fond_topographique ADD suivi_piezometrie_consommation_en_eau_id INT DEFAULT NULL;
ALTER TABLE fond_topographique ADD CONSTRAINT FK_40CBBDF780FE2435 FOREIGN KEY (suivi_piezometrie_consommation_en_eau_id) REFERENCES suivi_piezometrie_consommation_en_eau (id);
CREATE INDEX IDX_40CBBDF780FE2435 ON fond_topographique (suivi_piezometrie_consommation_en_eau_id);
ALTER TABLE plan_acces_site ADD suivi_piezometrie_consommation_en_eau_id INT DEFAULT NULL;
ALTER TABLE plan_acces_site ADD CONSTRAINT FK_2D34B5D880FE2435 FOREIGN KEY (suivi_piezometrie_consommation_en_eau_id) REFERENCES suivi_piezometrie_consommation_en_eau (id);
CREATE INDEX IDX_2D34B5D880FE2435 ON plan_acces_site (suivi_piezometrie_consommation_en_eau_id);
ALTER TABLE suivi_piezometrie_consommation_en_eau CHANGE unite_capacite_pompe unite_capacite_pompe VARCHAR(255) DEFAULT NULL, CHANGE volume_pompe volume_pompe NUMERIC(10, 2) DEFAULT NULL;

CREATE TABLE suivi_niveau_piezometrique (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, longitude_puit NUMERIC(10, 2) DEFAULT NULL, latitude_puit NUMERIC(10, 2) DEFAULT NULL, nom_puit_observation VARCHAR(255) DEFAULT NULL, qualite_eau VARCHAR(255) DEFAULT NULL, niveau_piezometrique NUMERIC(10, 2) DEFAULT NULL, unite_niveau_piezometrique VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_6FAB83B699201C9B (centre_exploitation_id), INDEX IDX_6FAB83B6A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE suivi_niveau_piezometrique ADD CONSTRAINT FK_6FAB83B699201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE suivi_niveau_piezometrique ADD CONSTRAINT FK_6FAB83B6A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE fond_topographique ADD suivi_niveau_piezometrique_id INT DEFAULT NULL;
ALTER TABLE fond_topographique ADD CONSTRAINT FK_40CBBDF7F638F615 FOREIGN KEY (suivi_niveau_piezometrique_id) REFERENCES suivi_niveau_piezometrique (id);
CREATE INDEX IDX_40CBBDF7F638F615 ON fond_topographique (suivi_niveau_piezometrique_id);
ALTER TABLE plan_acces_site ADD suivi_niveau_piezometrique_id INT DEFAULT NULL;
ALTER TABLE plan_acces_site ADD CONSTRAINT FK_2D34B5D8F638F615 FOREIGN KEY (suivi_niveau_piezometrique_id) REFERENCES suivi_niveau_piezometrique (id);
CREATE INDEX IDX_2D34B5D8F638F615 ON plan_acces_site (suivi_niveau_piezometrique_id);

CREATE TABLE produit_marchand (id INT AUTO_INCREMENT NOT NULL, nature_produit_id INT DEFAULT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_de_vente DATE DEFAULT NULL, numero_formulaire_de_declaration_et_vente VARCHAR(255) DEFAULT NULL, date_formulaire_declaration_et_vente DATE DEFAULT NULL, quantite_vendu_etranger NUMERIC(10, 2) DEFAULT NULL, teneur_produit_vendu_etranger NUMERIC(10, 2) DEFAULT NULL, impurete_nuisible VARCHAR(255) DEFAULT NULL, teneur_impurete_nuisible NUMERIC(10, 2) DEFAULT NULL, prix_unitaire_etranger NUMERIC(10, 2) DEFAULT NULL, prix_total_etranger NUMERIC(10, 2) DEFAULT NULL, prix_de_reference_etranger NUMERIC(10, 2) DEFAULT NULL, devise_prix_unitaire_etranger VARCHAR(255) DEFAULT NULL, devise_prix_total_etranger VARCHAR(255) DEFAULT NULL, devise_prix_de_reference_etranger VARCHAR(255) DEFAULT NULL, modalite_calcul_prix_vente_etranger NUMERIC(10, 2) DEFAULT NULL, devise_modalite_calcul_prix_etranger VARCHAR(255) DEFAULT NULL, qte_entite_traitement_interieur NUMERIC(10, 2) DEFAULT NULL, teneur_entite_traitement_interieur NUMERIC(10, 2) DEFAULT NULL, prix_unitaire_entite_traitement_interieur NUMERIC(10, 2) DEFAULT NULL, prix_total_entite_traitement_interieur NUMERIC(10, 2) DEFAULT NULL, prix_reference_entite_traitement_interieur NUMERIC(10, 2) DEFAULT NULL, montant_credit NUMERIC(10, 2) DEFAULT NULL, devise_prix_unitaire_entite_interieur VARCHAR(255) DEFAULT NULL, devise_prix_total_entite_interieur VARCHAR(255) DEFAULT NULL, devise_prix_reference_entite_interieur VARCHAR(255) DEFAULT NULL, devise_montant_credit VARCHAR(255) DEFAULT NULL, qte_autre_interieur NUMERIC(10, 2) DEFAULT NULL, teneur_autre_interieur NUMERIC(10, 2) DEFAULT NULL, impurete_invisible_autre_interieur VARCHAR(255) DEFAULT NULL, teneur_impurete_autre_interieur NUMERIC(10, 2) DEFAULT NULL, prix_unitaire_autre_interieur NUMERIC(10, 2) DEFAULT NULL, prix_total_autre_interieur NUMERIC(10, 2) DEFAULT NULL, prix_reference_autre_interieur NUMERIC(10, 2) DEFAULT NULL, modalite_autre_interieur NUMERIC(10, 2) DEFAULT NULL, devise_prix_unitaire_autre_interieur VARCHAR(255) DEFAULT NULL, devise_prix_total_autre_interieur VARCHAR(255) DEFAULT NULL, devise_prix_ref_autre_interieur VARCHAR(255) DEFAULT NULL, devise_modalite_autre_interieur VARCHAR(255) DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, description_produit_marchand LONGTEXT DEFAULT NULL, synthese_eude_faisabilite_approuve LONGTEXT DEFAULT NULL, justification_choix_methode LONGTEXT DEFAULT NULL, description_sommaire_methode LONGTEXT DEFAULT NULL, reference_societe_etrangere_traitement LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_B44C2385E34ACD6C (nature_produit_id), INDEX IDX_B44C238599201C9B (centre_exploitation_id), INDEX IDX_B44C2385A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE produit_marchand ADD CONSTRAINT FK_B44C2385E34ACD6C FOREIGN KEY (nature_produit_id) REFERENCES commodite (id);
ALTER TABLE produit_marchand ADD CONSTRAINT FK_B44C238599201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE produit_marchand ADD CONSTRAINT FK_B44C2385A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE vente_substance_minerale_brute (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, nature_substance_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, date_de_vente DATE DEFAULT NULL, date_formulaire_declaration_et_vente DATE DEFAULT NULL, numero_formulaire_de_declaration_et_vente VARCHAR(255) DEFAULT NULL, quantite NUMERIC(10, 2) DEFAULT NULL, teneur NUMERIC(10, 2) DEFAULT NULL, impurete_nuisible VARCHAR(255) DEFAULT NULL, teneur_en_element_utile NUMERIC(10, 2) DEFAULT NULL, prix_unitaire NUMERIC(10, 2) DEFAULT NULL, prix_total NUMERIC(10, 2) DEFAULT NULL, prix_reference NUMERIC(10, 2) DEFAULT NULL, modalite_calcul_prix_vente NUMERIC(10, 2) DEFAULT NULL, devise_prix_unitaire VARCHAR(255) DEFAULT NULL, devise_prix_total VARCHAR(255) DEFAULT NULL, devise_prix_reference VARCHAR(255) DEFAULT NULL, devise_modalite VARCHAR(255) DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, synthese_eude_faisabilite_approuve LONGTEXT DEFAULT NULL, description_substance_minerale LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_82C1C7099201C9B (centre_exploitation_id), INDEX IDX_82C1C70AB6FF28D (nature_substance_id), INDEX IDX_82C1C70A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE vente_substance_minerale_brute ADD CONSTRAINT FK_82C1C7099201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE vente_substance_minerale_brute ADD CONSTRAINT FK_82C1C70AB6FF28D FOREIGN KEY (nature_substance_id) REFERENCES commodite (id);
ALTER TABLE vente_substance_minerale_brute ADD CONSTRAINT FK_82C1C70A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE vente_nature_produit_marchand (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, substance_marchand_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, date_de_vente DATE DEFAULT NULL, quantite NUMERIC(10, 2) DEFAULT NULL, teneur NUMERIC(10, 2) DEFAULT NULL, prix NUMERIC(10, 2) DEFAULT NULL, devise_prix VARCHAR(255) DEFAULT NULL, montant_taxation_unique NUMERIC(10, 2) DEFAULT NULL, devise_montant_taxation VARCHAR(255) DEFAULT NULL, denomination_acheteur VARCHAR(255) DEFAULT NULL, adresse_acheteur VARCHAR(255) DEFAULT NULL, numero_attestation_transport VARCHAR(255) DEFAULT NULL, numero_certificat_origine VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, description_produit_marchand LONGTEXT DEFAULT NULL, synthese_eude_faisabilite_approuve LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_1E31176D99201C9B (centre_exploitation_id), INDEX IDX_1E31176D1DFD5ECE (substance_marchand_id), INDEX IDX_1E31176DA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE vente_nature_produit_marchand ADD CONSTRAINT FK_1E31176D99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE vente_nature_produit_marchand ADD CONSTRAINT FK_1E31176D1DFD5ECE FOREIGN KEY (substance_marchand_id) REFERENCES commodite (id);
ALTER TABLE vente_nature_produit_marchand ADD CONSTRAINT FK_1E31176DA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE transfert_fonds_en_faveur_societe_affiliee (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, denomination_societe_affilee VARCHAR(255) DEFAULT NULL, repartition_capital_societe_affilee NUMERIC(10, 2) DEFAULT NULL, adresse_societe_affiliee VARCHAR(255) DEFAULT NULL, date_de_transfert DATE DEFAULT NULL, montant_transfere_en_chiffre NUMERIC(10, 2) DEFAULT NULL, devise_montant_transfere VARCHAR(255) DEFAULT NULL, montant_transfere_en_lettre VARCHAR(255) DEFAULT NULL, numero_compte_debit VARCHAR(255) DEFAULT NULL, numero_compte_credit VARCHAR(255) DEFAULT NULL, indentite_donneur_ordre VARCHAR(255) DEFAULT NULL, identite_receveur_ordre VARCHAR(255) DEFAULT NULL, reference_contrat_vente VARCHAR(255) DEFAULT NULL, date_transmission_rapport DATE DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_BE74899699201C9B (centre_exploitation_id), INDEX IDX_BE748996A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE transfert_fonds_en_faveur_societe_affiliee ADD CONSTRAINT FK_BE74899699201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE transfert_fonds_en_faveur_societe_affiliee ADD CONSTRAINT FK_BE748996A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE expedition_et_autorisation_origine (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, produit_minier_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, date_expedition DATE DEFAULT NULL, numero_lot VARCHAR(255) DEFAULT NULL, numero_attestation_transport VARCHAR(255) DEFAULT NULL, numero_retrait_formulaire VARCHAR(255) DEFAULT NULL, date_retrait_formulaire DATE DEFAULT NULL, tonnage NUMERIC(10, 2) DEFAULT NULL, teneur NUMERIC(10, 2) DEFAULT NULL, numero_certificat_origine VARCHAR(255) DEFAULT NULL, numero_cvee VARCHAR(255) DEFAULT NULL, numero_declaration_modele VARCHAR(255) DEFAULT NULL, numero_occ VARCHAR(255) DEFAULT NULL, contrat_vente VARCHAR(255) DEFAULT NULL, prix_vente NUMERIC(10, 2) DEFAULT NULL, devise_prix_vente VARCHAR(255) DEFAULT NULL, modalite_paiement NUMERIC(10, 2) DEFAULT NULL, devise_modalite_paiement VARCHAR(255) DEFAULT NULL, denomination_destinataire VARCHAR(255) DEFAULT NULL, adresse_destinataire VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, description_produit_minier_expedie LONGTEXT DEFAULT NULL, synthese_eude_faisabilite_approuve LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_DEACCA7799201C9B (centre_exploitation_id), INDEX IDX_DEACCA77FD807203 (produit_minier_id), INDEX IDX_DEACCA77A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE expedition_et_autorisation_origine ADD CONSTRAINT FK_DEACCA7799201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES expedition_et_autorisation_origine (id);
ALTER TABLE expedition_et_autorisation_origine ADD CONSTRAINT FK_DEACCA77FD807203 FOREIGN KEY (produit_minier_id) REFERENCES commodite (id);
ALTER TABLE expedition_et_autorisation_origine ADD CONSTRAINT FK_DEACCA77A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE expedition_et_autorisation_origine DROP FOREIGN KEY FK_DEACCA7799201C9B;
DROP INDEX IDX_DEACCA7799201C9B ON expedition_et_autorisation_origine;
ALTER TABLE expedition_et_autorisation_origine DROP centre_exploitation_id;

ALTER TABLE expedition_et_autorisation_origine ADD centre_exploitation_id INT DEFAULT NULL;
ALTER TABLE expedition_et_autorisation_origine ADD CONSTRAINT FK_DEACCA7799201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
CREATE INDEX IDX_DEACCA7799201C9B ON expedition_et_autorisation_origine (centre_exploitation_id);

ALTER TABLE expedition_et_autorisation_origine ADD poste_de_sortie VARCHAR(255) DEFAULT NULL;

CREATE TABLE expedition_et_autorisation_origine_produit_carriere (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, produit_expedie_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, date_expedition DATE DEFAULT NULL, numero_lot VARCHAR(255) DEFAULT NULL, numero_attestation_transport VARCHAR(255) DEFAULT NULL, numero_retrait_formulaire VARCHAR(255) DEFAULT NULL, date_retrait_formulaire DATE DEFAULT NULL, quantite NUMERIC(10, 2) DEFAULT NULL, numero_cvee VARCHAR(255) DEFAULT NULL, numero_declaration_modele VARCHAR(255) DEFAULT NULL, contrat_vente VARCHAR(255) DEFAULT NULL, poste_de_sortie VARCHAR(255) DEFAULT NULL, numero_occ VARCHAR(255) DEFAULT NULL, modalite_paiement NUMERIC(10, 2) DEFAULT NULL, devise_modalite_paiement VARCHAR(255) DEFAULT NULL, denomination_destinataire VARCHAR(255) DEFAULT NULL, adresse_destinataire VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, observation_inspecteur_direction_mine LONGTEXT DEFAULT NULL, cote_inspecteur_direction_mine NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_55005D6799201C9B (centre_exploitation_id), INDEX IDX_55005D67D1664E33 (produit_expedie_id), INDEX IDX_55005D67A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE expedition_et_autorisation_origine_produit_carriere ADD CONSTRAINT FK_55005D6799201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE expedition_et_autorisation_origine_produit_carriere ADD CONSTRAINT FK_55005D67D1664E33 FOREIGN KEY (produit_expedie_id) REFERENCES commodite (id);
ALTER TABLE expedition_et_autorisation_origine_produit_carriere ADD CONSTRAINT FK_55005D67A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

CREATE TABLE provision_reconstitution_gisement (id INT AUTO_INCREMENT NOT NULL, centre_exploitation_id INT DEFAULT NULL, user_id INT DEFAULT NULL, mois_annee_rapport VARCHAR(255) DEFAULT NULL, observations LONGTEXT DEFAULT NULL, cote_inspecteur NUMERIC(10, 2) DEFAULT NULL, observations_inspecteur_direction_environnement LONGTEXT DEFAULT NULL, exercice_provision VARCHAR(255) DEFAULT NULL, montant_provision_gisement NUMERIC(10, 2) DEFAULT NULL, montant_activite_recherche NUMERIC(10, 2) DEFAULT NULL, devise_montant_provision_gisement VARCHAR(255) DEFAULT NULL, devise_montant_activite_recherche VARCHAR(255) DEFAULT NULL, montant_prise_participation_capital NUMERIC(10, 2) DEFAULT NULL, devise_montant_prise_participation_capital VARCHAR(255) DEFAULT NULL, execution_physique NUMERIC(10, 2) DEFAULT NULL, execution_financiere NUMERIC(10, 2) DEFAULT NULL, resultat_travaux_effectues LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_B352EDCE99201C9B (centre_exploitation_id), INDEX IDX_B352EDCEA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE provision_reconstitution_gisement ADD CONSTRAINT FK_B352EDCE99201C9B FOREIGN KEY (centre_exploitation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE provision_reconstitution_gisement ADD CONSTRAINT FK_B352EDCEA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE amodiation ADD type_amodiation VARCHAR(255) DEFAULT NULL, ADD date_signature_contrat DATE DEFAULT NULL, ADD date_declaration_cami DATE DEFAULT NULL;
ALTER TABLE cession ADD date_declaration_cami DATE DEFAULT NULL;
ALTER TABLE versement_redevance ADD devise VARCHAR(255) DEFAULT NULL;
ALTER TABLE redevance ADD note_debut VARCHAR(255) DEFAULT NULL;

HT2 SERVEUR


ALTER TABLE ouverture_centre_exportation DROP FOREIGN KEY FK_CB7570AAC18272;
DROP INDEX UNIQ_CB7570AAC18272 ON ouverture_centre_exportation;
ALTER TABLE ouverture_centre_exportation DROP projet_id;


ALTER TABLE ouverture_centre_exportation ADD projet_id INT DEFAULT NULL;
ALTER TABLE ouverture_centre_exportation ADD CONSTRAINT FK_CB7570AAC18272 FOREIGN KEY (projet_id) REFERENCES projet (id);
CREATE INDEX IDX_CB7570AAC18272 ON ouverture_centre_exportation (projet_id);

CREATE TABLE sous_categorie (id INT AUTO_INCREMENT NOT NULL, categorie_id INT DEFAULT NULL, user_id INT DEFAULT NULL, nom VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_52743D7BBCF5E72D (categorie_id), INDEX IDX_52743D7BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE sous_categorie ADD CONSTRAINT FK_52743D7BBCF5E72D FOREIGN KEY (categorie_id) REFERENCES categorie (id);
ALTER TABLE sous_categorie ADD CONSTRAINT FK_52743D7BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);


ALTER TABLE operateur ADD sous_categorie_id INT DEFAULT NULL;
ALTER TABLE operateur ADD CONSTRAINT FK_B4B7F99D365BF48 FOREIGN KEY (sous_categorie_id) REFERENCES sous_categorie (id);
CREATE INDEX IDX_B4B7F99D365BF48 ON operateur (sous_categorie_id)


ALTER TABLE `option` ADD contrat_id INT DEFAULT NULL;
ALTER TABLE `option` ADD CONSTRAINT FK_5A8600B01823061F FOREIGN KEY (contrat_id) REFERENCES contrat_principal (id);
CREATE UNIQUE INDEX UNIQ_5A8600B01823061F ON `option` (contrat_id);
ALTER TABLE cession ADD contrat_id INT DEFAULT NULL;
ALTER TABLE cession ADD CONSTRAINT FK_B79A491A1823061F FOREIGN KEY (contrat_id) REFERENCES cession (id);
CREATE UNIQUE INDEX UNIQ_B79A491A1823061F ON cession (contrat_id);
ALTER TABLE amodiation ADD contrat_id INT DEFAULT NULL;
ALTER TABLE amodiation ADD CONSTRAINT FK_662C47161823061F FOREIGN KEY (contrat_id) REFERENCES contrat_principal (id);
CREATE UNIQUE INDEX UNIQ_662C47161823061F ON amodiation (contrat_id);

ALTER TABLE cession DROP FOREIGN KEY FK_B79A491A1823061F;
DROP INDEX UNIQ_B79A491A1823061F ON cession;
ALTER TABLE cession DROP contrat_id;

ALTER TABLE cession ADD contrat_id INT DEFAULT NULL;
ALTER TABLE cession ADD CONSTRAINT FK_B79A491A1823061F FOREIGN KEY (contrat_id) REFERENCES contrat_principal (id);
CREATE UNIQUE INDEX UNIQ_B79A491A1823061F ON cession (contrat_id);


ALTER TABLE versement_redevance CHANGE montant montant NUMERIC(20, 2) DEFAULT NULL;

CREATE TABLE option_titre_minier (option_id INT NOT NULL, titre_minier_id INT NOT NULL, INDEX IDX_CD7D9870A7C41D6F (option_id), INDEX IDX_CD7D98703DC61AC6 (titre_minier_id), PRIMARY KEY(option_id, titre_minier_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE cession_titre_minier (cession_id INT NOT NULL, titre_minier_id INT NOT NULL, INDEX IDX_2F0CCD1846916D37 (cession_id), INDEX IDX_2F0CCD183DC61AC6 (titre_minier_id), PRIMARY KEY(cession_id, titre_minier_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE amodiation_titre_minier (amodiation_id INT NOT NULL, titre_minier_id INT NOT NULL, INDEX IDX_5B6AF74AF30AAFB5 (amodiation_id), INDEX IDX_5B6AF74A3DC61AC6 (titre_minier_id), PRIMARY KEY(amodiation_id, titre_minier_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE option_titre_minier ADD CONSTRAINT FK_CD7D9870A7C41D6F FOREIGN KEY (option_id) REFERENCES `option` (id) ON DELETE CASCADE;
ALTER TABLE option_titre_minier ADD CONSTRAINT FK_CD7D98703DC61AC6 FOREIGN KEY (titre_minier_id) REFERENCES titre_minier (id) ON DELETE CASCADE;
ALTER TABLE cession_titre_minier ADD CONSTRAINT FK_2F0CCD1846916D37 FOREIGN KEY (cession_id) REFERENCES cession (id) ON DELETE CASCADE;
ALTER TABLE cession_titre_minier ADD CONSTRAINT FK_2F0CCD183DC61AC6 FOREIGN KEY (titre_minier_id) REFERENCES titre_minier (id) ON DELETE CASCADE;
ALTER TABLE amodiation_titre_minier ADD CONSTRAINT FK_5B6AF74AF30AAFB5 FOREIGN KEY (amodiation_id) REFERENCES amodiation (id) ON DELETE CASCADE;
ALTER TABLE amodiation_titre_minier ADD CONSTRAINT FK_5B6AF74A3DC61AC6 FOREIGN KEY (titre_minier_id) REFERENCES titre_minier (id) ON DELETE CASCADE;

ALTER TABLE projet_dot ADD province_id INT DEFAULT NULL;
ALTER TABLE projet_dot ADD CONSTRAINT FK_D04DC1A2E946114A FOREIGN KEY (province_id) REFERENCES province (id);
CREATE INDEX IDX_D04DC1A2E946114A ON projet_dot (province_id);

ALTER TABLE fermeture_centre_exploitation CHANGE date_declaration_fermeture date_declaration_fermeture DATE DEFAULT NULL;
ALTER TABLE exportation ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;
ALTER TABLE engin ADD capacite_effective NUMERIC(10, 2) DEFAULT NULL;
ALTER TABLE operateur ADD entreprise_itie TINYINT(1) DEFAULT NULL;
*/

/*  */
ALTER TABLE ouverture_centre_recherche ADD mois_annee_rapport VARCHAR(255) DEFAULT NULL;
ALTER TABLE fermeture_centre_de_recherche CHANGE mois_annee_rapport mois_annee_rapport LONGTEXT DEFAULT NULL;

/*  */
ALTER TABLE impact_environnemental_activite_miniere ADD systeme_environnemental VARCHAR(255) DEFAULT NULL;

/*  */
ALTER TABLE chantier_exploitation ADD observations_inspecteur LONGTEXT DEFAULT NULL;

/*  */
ALTER TABLE chantier_de_recherche ADD observations_inspecteur LONGTEXT DEFAULT NULL;

/*  */
ALTER TABLE exportation ADD ouverture_centre_exportation_id INT DEFAULT NULL;
ALTER TABLE exportation ADD CONSTRAINT FK_F2D01343BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id);
CREATE INDEX IDX_F2D01343BDFEE108 ON exportation (ouverture_centre_exportation_id);
ALTER TABLE vente_local ADD ouverture_centre_exportation_id INT DEFAULT NULL;
ALTER TABLE vente_local ADD CONSTRAINT FK_9FC785A1BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id);
CREATE INDEX IDX_9FC785A1BDFEE108 ON vente_local (ouverture_centre_exportation_id);
ALTER TABLE production ADD ouverture_centre_exportation_id INT DEFAULT NULL, ADD zea_id INT DEFAULT NULL;
ALTER TABLE production ADD CONSTRAINT FK_D3EDB1E0BDFEE108 FOREIGN KEY (ouverture_centre_exportation_id) REFERENCES ouverture_centre_exportation (id);
ALTER TABLE production ADD CONSTRAINT FK_D3EDB1E05033FB7D FOREIGN KEY (zea_id) REFERENCES zea (id);
CREATE INDEX IDX_D3EDB1E0BDFEE108 ON production (ouverture_centre_exportation_id);
CREATE INDEX IDX_D3EDB1E05033FB7D ON production (zea_id);

ALTER TABLE production DROP FOREIGN KEY FK_D3EDB1E05033FB7D;
DROP INDEX IDX_D3EDB1E05033FB7D ON production;
ALTER TABLE production CHANGE zea_id site_id INT DEFAULT NULL;
ALTER TABLE production ADD CONSTRAINT FK_D3EDB1E0F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id);
CREATE INDEX IDX_D3EDB1E0F6BD1646 ON production (site_id);

/* CTCPM */
CREATE TABLE quota_exportation_cobalt (id INT AUTO_INCREMENT NOT NULL, type_commodite_id INT DEFAULT NULL, operateur_id INT DEFAULT NULL, user_id INT DEFAULT NULL, quota NUMERIC(20, 2) DEFAULT NULL, date_quota DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_42F7F46B29209030 (type_commodite_id), INDEX IDX_42F7F46B3F192FC (operateur_id), INDEX IDX_42F7F46BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE quota_exportation_cobalt ADD CONSTRAINT FK_42F7F46B29209030 FOREIGN KEY (type_commodite_id) REFERENCES type_commodite (id);
ALTER TABLE quota_exportation_cobalt ADD CONSTRAINT FK_42F7F46B3F192FC FOREIGN KEY (operateur_id) REFERENCES operateur (id);
ALTER TABLE quota_exportation_cobalt ADD CONSTRAINT FK_42F7F46BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

/* CTCPM */
ALTER TABLE projet ADD longitude NUMERIC(20, 20) DEFAULT NULL, ADD latitude NUMERIC(20, 20) DEFAULT NULL;
ALTER TABLE projet CHANGE longitude longitude NUMERIC(20, 10) DEFAULT NULL, CHANGE latitude latitude NUMERIC(20, 10) DEFAULT NULL;

/* CTCPM */
CREATE TABLE employe_projet_dot (id INT AUTO_INCREMENT NOT NULL, pays_id INT DEFAULT NULL, user_id INT DEFAULT NULL, noms VARCHAR(255) DEFAULT NULL, sexe VARCHAR(255) DEFAULT NULL, adresse VARCHAR(255) DEFAULT NULL, fonction VARCHAR(255) DEFAULT NULL, date_de_naissance DATE DEFAULT NULL, date_engagement DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_52841B65A6E44244 (pays_id), INDEX IDX_52841B65A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE employe_projet_cahier_de_charge (id INT AUTO_INCREMENT NOT NULL, pays_id INT DEFAULT NULL, user_id INT DEFAULT NULL, noms VARCHAR(255) DEFAULT NULL, sexe VARCHAR(255) DEFAULT NULL, adresse VARCHAR(255) DEFAULT NULL, fonction VARCHAR(255) DEFAULT NULL, date_de_naissance DATE DEFAULT NULL, date_engagement DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_384024F3A6E44244 (pays_id), INDEX IDX_384024F3A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
CREATE TABLE employe_projet_etd (id INT AUTO_INCREMENT NOT NULL, pays_id INT DEFAULT NULL, user_id INT DEFAULT NULL, noms VARCHAR(255) DEFAULT NULL, sexe VARCHAR(255) DEFAULT NULL, adresse VARCHAR(255) DEFAULT NULL, fonction VARCHAR(255) DEFAULT NULL, date_de_naissance DATE DEFAULT NULL, date_engagement DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_E7C7AAACA6E44244 (pays_id), INDEX IDX_E7C7AAACA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE employe_projet_dot ADD CONSTRAINT FK_52841B65A6E44244 FOREIGN KEY (pays_id) REFERENCES pays (id);
ALTER TABLE employe_projet_dot ADD CONSTRAINT FK_52841B65A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE employe_projet_cahier_de_charge ADD CONSTRAINT FK_384024F3A6E44244 FOREIGN KEY (pays_id) REFERENCES pays (id);
ALTER TABLE employe_projet_cahier_de_charge ADD CONSTRAINT FK_384024F3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE employe_projet_etd ADD CONSTRAINT FK_E7C7AAACA6E44244 FOREIGN KEY (pays_id) REFERENCES pays (id);
ALTER TABLE employe_projet_etd ADD CONSTRAINT FK_E7C7AAACA76ED395 FOREIGN KEY (user_id) REFERENCES user (id);

ALTER TABLE employe_projet_dot ADD projet_id INT DEFAULT NULL;
ALTER TABLE employe_projet_dot ADD CONSTRAINT FK_52841B65C18272 FOREIGN KEY (projet_id) REFERENCES projet_dot (id);
CREATE INDEX IDX_52841B65C18272 ON employe_projet_dot (projet_id);
ALTER TABLE employe_projet_cahier_de_charge ADD projet_id INT DEFAULT NULL;
ALTER TABLE employe_projet_cahier_de_charge ADD CONSTRAINT FK_384024F3C18272 FOREIGN KEY (projet_id) REFERENCES projet_cahier_de_charge (id);
CREATE INDEX IDX_384024F3C18272 ON employe_projet_cahier_de_charge (projet_id);
ALTER TABLE employe_projet_etd ADD projet_id INT DEFAULT NULL;
ALTER TABLE employe_projet_etd ADD CONSTRAINT FK_E7C7AAACC18272 FOREIGN KEY (projet_id) REFERENCES projet_etd (id);
CREATE INDEX IDX_E7C7AAACC18272 ON employe_projet_etd (projet_id);

/* CTCPM */
ALTER TABLE redevance ADD taux NUMERIC(10, 2) DEFAULT NULL;
ALTER TABLE redevance ADD montant_en_cdf NUMERIC(20, 2) DEFAULT NULL, ADD montant_en_usd NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE versement_redevance ADD montant_en_cdf NUMERIC(20, 2) DEFAULT NULL, ADD montant_en_usd NUMERIC(20, 2) DEFAULT NULL, ADD taux NUMERIC(10, 2) DEFAULT NULL;

CREATE TABLE stock (id INT AUTO_INCREMENT NOT NULL, commodite_id INT DEFAULT NULL, operateur_id INT DEFAULT NULL, user_id INT DEFAULT NULL, quantite NUMERIC(10, 2) DEFAULT NULL, date_stock DATE DEFAULT NULL, teneur NUMERIC(10, 2) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4B365660AE632A35 (commodite_id), INDEX IDX_4B3656603F192FC (operateur_id), INDEX IDX_4B365660A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE stock ADD CONSTRAINT FK_4B365660AE632A35 FOREIGN KEY (commodite_id) REFERENCES commodite (id);
ALTER TABLE stock ADD CONSTRAINT FK_4B3656603F192FC FOREIGN KEY (operateur_id) REFERENCES operateur (id);
ALTER TABLE stock ADD CONSTRAINT FK_4B365660A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
ALTER TABLE stock ADD valeur NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE stock ADD date_de_stock DATETIME DEFAULT NULL;
ALTER TABLE stock DROP date_de_stock;

/* CTCPM */
CREATE TABLE projet_fomin (id INT AUTO_INCREMENT NOT NULL, nature_id INT DEFAULT NULL, province_id INT DEFAULT NULL, nom VARCHAR(255) DEFAULT NULL, budget NUMERIC(10, 2) DEFAULT NULL, localisation VARCHAR(255) DEFAULT NULL, stade VARCHAR(255) DEFAULT NULL, annotation LONGTEXT DEFAULT NULL, date_debut DATETIME DEFAULT NULL, date_fin DATETIME DEFAULT NULL, executant VARCHAR(255) DEFAULT NULL, reference_passation_marche VARCHAR(255) DEFAULT NULL, evaluation VARCHAR(255) DEFAULT NULL, satisfaction VARCHAR(255) DEFAULT NULL, niveau_execution NUMERIC(10, 2) DEFAULT NULL, approbation_ministre VARCHAR(255) DEFAULT NULL, is_publish TINYINT(1) DEFAULT NULL, INDEX IDX_4689B9D13BCB2E4B (nature_id), INDEX IDX_4689B9D1E946114A (province_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
ALTER TABLE projet_fomin ADD CONSTRAINT FK_4689B9D13BCB2E4B FOREIGN KEY (nature_id) REFERENCES nature_projet (id);
ALTER TABLE projet_fomin ADD CONSTRAINT FK_4689B9D1E946114A FOREIGN KEY (province_id) REFERENCES province (id);
ALTER TABLE image ADD projet_fomin_id INT DEFAULT NULL;
ALTER TABLE image ADD CONSTRAINT FK_C53D045F4B69B404 FOREIGN KEY (projet_fomin_id) REFERENCES projet_fomin (id);
CREATE INDEX IDX_C53D045F4B69B404 ON image (projet_fomin_id);

ALTER TABLE projet_fomin ADD user_id INT DEFAULT NULL, ADD created_at DATETIME DEFAULT NULL, ADD updated_at DATETIME DEFAULT NULL, ADD deleted_at DATETIME DEFAULT NULL;
ALTER TABLE projet_fomin ADD CONSTRAINT FK_4689B9D1A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);
CREATE INDEX IDX_4689B9D1A76ED395 ON projet_fomin (user_id);

/* CTCPM */
ALTER TABLE production CHANGE cout cout_en_USD BIGINT DEFAULT NULL;
ALTER TABLE exportation CHANGE prix prix_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE vente_local CHANGE prix_local prix_local_en_USD BIGINT DEFAULT NULL;

ALTER TABLE vente_local CHANGE prix_local_en_USD prix_local_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE production CHANGE cout_en_USD cout_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE projet CHANGE type_projet categorie_projet VARCHAR(255) DEFAULT NULL;
ALTER TABLE projet CHANGE categorie type_projet VARCHAR(255) DEFAULT NULL;
ALTER TABLE projet DROP type_mine;
ALTER TABLE environemental CHANGE plan nom VARCHAR(255) DEFAULT NULL;
ALTER TABLE environemental CHANGE num_approbation numero_approbation VARCHAR(255) DEFAULT NULL;
ALTER TABLE environemental CHANGE approuve approbation VARCHAR(255) DEFAULT NULL;
ALTER TABLE environemental CHANGE impact_pot impact_potentiel VARCHAR(255) DEFAULT NULL;
ALTER TABLE plan_environnemental CHANGE plan nom VARCHAR(255) DEFAULT NULL;
ALTER TABLE plan_environnemental CHANGE approuve approbation VARCHAR(255) DEFAULT NULL;
ALTER TABLE plan_environnemental CHANGE date_enviro date_plan DATE DEFAULT NULL;
ALTER TABLE plan_environnemental CHANGE num_approbation numero_approbation VARCHAR(255) DEFAULT NULL;
ALTER TABLE environemental CHANGE date_enviro date_etude DATE DEFAULT NULL;

ALTER TABLE titre_minier CHANGE permis numero_permis INT DEFAULT NULL;
ALTER TABLE titre_minier CHANGE status statut VARCHAR(255) DEFAULT NULL;
ALTER TABLE titre_minier CHANGE carres carre_minier INT DEFAULT NULL;
ALTER TABLE contrat_principal CHANGE pas_de_porte pas_de_porte_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE contrat_principal CHANGE loyer_annuel loyer_annuel_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE contrat_principal CHANGE royaltie royalties_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE contrat_principal CHANGE dure duree_en_nombre_d_annee INT DEFAULT NULL;
ALTER TABLE contrat_relatif CHANGE dure duree_en_nombre_d_annee INT DEFAULT NULL;
ALTER TABLE contrat_relatif CHANGE pas_de_porte pas_de_porte_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE contrat_relatif CHANGE loyer_annuel loyer_annuel_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE contrat_relatif CHANGE royaltie royalties_en_USD NUMERIC(20, 2) DEFAULT NULL;
ALTER TABLE contrat_relatif CHANGE part_etat part_de_l_etat_en_pourcentage INT DEFAULT NULL;
ALTER TABLE contrat_principal CHANGE part_etat part_de_l_etat_en_pourcentage INT DEFAULT NULL;

DROP INDEX UNIQ_B4B7F99DA07792A0 ON operateur;
ALTER TABLE operateur CHANGE num_import_export numero_import_export VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99DE2603523 ON operateur (numero_import_export);

DROP INDEX UNIQ_B4B7F99DC6CC097D ON operateur;
ALTER TABLE operateur CHANGE num_affactation_inss numero_affactation_inss VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99D472A030F ON operateur (numero_affactation_inss);

DROP INDEX UNIQ_B4B7F99DB4516192 ON operateur;
ALTER TABLE operateur CHANGE num_affectation_inpp numero_affectation_inpp VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99D35B76BE0 ON operateur (numero_affectation_inpp);

DROP INDEX UNIQ_B4B7F99D9F169D98 ON operateur;
ALTER TABLE operateur CHANGE num_ident_fiscal nif VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99DADE62BBB ON operateur (nif);

DROP INDEX UNIQ_B4B7F99DFFEE978E ON operateur;
ALTER TABLE operateur CHANGE num_tva numero_tva VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99DDA3E1097 ON operateur (numero_tva);

DROP INDEX UNIQ_B4B7F99DD2C2946E ON operateur;
ALTER TABLE operateur CHANGE num_dgda numero_dgda VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99DB68CEC29 ON operateur (numero_dgda);

DROP INDEX UNIQ_B4B7F99DBECA9FDC ON operateur;
ALTER TABLE operateur CHANGE num_dgi numero_dgi VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99D9B1A18C5 ON operateur (numero_dgi);

DROP INDEX UNIQ_B4B7F99D2AAE1BC5 ON operateur;
ALTER TABLE operateur CHANGE num_dgrad numero_dgrad VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99DC272818E ON operateur (numero_dgrad);

DROP INDEX UNIQ_B4B7F99D36265C27 ON operateur;
ALTER TABLE operateur CHANGE num_occ numero_occ VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_B4B7F99D13F6DB3E ON operateur (numero_occ);

ALTER TABLE information_emploi CHANGE nbre_employer nombre_employer INT DEFAULT NULL;
ALTER TABLE information_emploi CHANGE nbre_feminin_local nombre_employe_feminin_local INT DEFAULT NULL;
ALTER TABLE information_emploi CHANGE nombre_employer nombre_employe INT DEFAULT NULL;
ALTER TABLE information_emploi CHANGE nbre_masculin_local nombre_employe_masculin_local INT DEFAULT NULL;
ALTER TABLE information_emploi CHANGE nbre_cadre nombre_employe_cadre INT DEFAULT NULL;
ALTER TABLE information_emploi CHANGE nbre_ouvrier nombre_employe_ouvrier INT DEFAULT NULL;
ALTER TABLE information_emploi CHANGE nbre_feminin_etranger nombre_employe_feminin_etranger INT DEFAULT NULL;
ALTER TABLE information_emploi CHANGE nbre_masculin_etranger nombre_employe_masculin_etranger INT DEFAULT NULL;
ALTER TABLE acquisition CHANGE nbr_action_directe nombre_d_action_directe INT DEFAULT NULL;
ALTER TABLE acquisition CHANGE nbr_action_indirecte nombre_d_action_indirecte INT DEFAULT NULL;
ALTER TABLE acquisition CHANGE percent_action pourcentage_des_actions INT DEFAULT NULL;
ALTER TABLE acquisition CHANGE moyen_acquis moyen_d_acquisition VARCHAR(255) DEFAULT NULL;
ALTER TABLE acquisition CHANGE date_acquis date_d_acquisition DATE DEFAULT NULL;
ALTER TABLE mandataire CHANGE noms nom_complet VARCHAR(255) DEFAULT NULL;

DROP INDEX UNIQ_1DA4DCB4FD12A57E ON mandataire;
ALTER TABLE mandataire CHANGE num_arret_agrement numero_d_arret_d_agrement VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_1DA4DCB46BE316B4 ON mandataire (numero_d_arret_d_agrement);

ALTER TABLE mandataire CHANGE date_agrement date_de_debut_d_agrement DATETIME DEFAULT NULL;
ALTER TABLE mandataire CHANGE fin_val_agrement date_de_fin_de_valideite_d_agrement DATETIME DEFAULT NULL;
ALTER TABLE mandataire CHANGE date_de_fin_de_valideite_d_agrement date_de_fin_de_validite_d_agrement DATETIME DEFAULT NULL;

DROP INDEX UNIQ_1DA4DCB4D21FD50F ON mandataire;
ALTER TABLE mandataire CHANGE num_agrement numero_d_agrement VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_1DA4DCB498BE8CD8 ON mandataire (numero_d_agrement);

DROP INDEX UNIQ_1DA4DCB4BECA9FDC ON mandataire;
ALTER TABLE mandataire CHANGE num_dgi numero_dgi VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_1DA4DCB49B1A18C5 ON mandataire (numero_dgi);

DROP INDEX UNIQ_1DA4DCB42AAE1BC5 ON mandataire;
ALTER TABLE mandataire CHANGE num_dgrad numero_dgrad VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_1DA4DCB4C272818E ON mandataire (numero_dgrad);

ALTER TABLE mandataire CHANGE fin_validite date_de_fin_de_validite DATETIME DEFAULT NULL;

DROP INDEX UNIQ_1DA4DCB49F169D98 ON mandataire;
ALTER TABLE mandataire CHANGE num_ident_fiscal nif VARCHAR(255) DEFAULT NULL;
CREATE UNIQUE INDEX UNIQ_1DA4DCB4ADE62BBB ON mandataire (nif);

ALTER TABLE rapatriement CHANGE montant_vendu montant_vendu_en_USD BIGINT DEFAULT NULL;
ALTER TABLE rapatriement CHANGE banque_debuter banque_debitrice VARCHAR(255) DEFAULT NULL;
ALTER TABLE rapatriement CHANGE montant_rapatrier montant_rapatrie_en_USD BIGINT DEFAULT NULL;
ALTER TABLE rapatriement CHANGE banque_benef banque_beneficiaire VARCHAR(255) DEFAULT NULL;
ALTER TABLE redevance CHANGE banque_debuter banque_debitrice VARCHAR(255) DEFAULT NULL;
ALTER TABLE taxe CHANGE banque_debuter banque_debitrice VARCHAR(255) DEFAULT NULL;
ALTER TABLE droit CHANGE banque_debutaire banque_debitrice VARCHAR(255) DEFAULT NULL;
ALTER TABLE versement_dot CHANGE montant montant_en_USD NUMERIC(10, 2) DEFAULT NULL;
ALTER TABLE versement_dot CHANGE banque_debuter banque_debitrice VARCHAR(255) DEFAULT NULL;
ALTER TABLE versement_redevance CHANGE banque_debuter banque_debitrice VARCHAR(255) DEFAULT NULL;
