--
-- BEGIN / Augmente le nombre de caractère pour la numérotation des dossiers
--

ALTER TABLE dossier ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE dossier ALTER COLUMN dossier_libelle TYPE character varying(255);
ALTER TABLE dossier ALTER COLUMN dossier_autorisation TYPE character varying(255);
ALTER TABLE dossier ALTER COLUMN autorisation_contestee TYPE character varying(255);
ALTER TABLE dossier_autorisation ALTER COLUMN dossier_autorisation TYPE character varying(255);
ALTER TABLE dossier_autorisation ALTER COLUMN dossier_autorisation_libelle TYPE character varying(255);
ALTER TABLE demande ALTER COLUMN dossier_instruction TYPE character varying(255);
ALTER TABLE demande ALTER COLUMN dossier_autorisation TYPE character varying(255);
ALTER TABLE document_numerise ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE donnees_techniques ALTER COLUMN dossier_instruction TYPE character varying(255);
ALTER TABLE donnees_techniques ALTER COLUMN dossier_autorisation TYPE character varying(255);
ALTER TABLE dossier_autorisation_parcelle ALTER COLUMN dossier_autorisation TYPE character varying(255);
ALTER TABLE dossier_commission ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE dossier_contrainte ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE dossier_geolocalisation ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE dossier_message ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE dossier_parcelle ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE instruction ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE instruction ALTER COLUMN destinataire TYPE character varying(255);
ALTER TABLE lien_dossier_autorisation_demandeur ALTER COLUMN dossier_autorisation TYPE character varying(255);
ALTER TABLE lien_dossier_demandeur ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE lien_dossier_dossier ALTER COLUMN dossier_src TYPE character varying(255);
ALTER TABLE lien_dossier_dossier ALTER COLUMN dossier_cible TYPE character varying(255);
ALTER TABLE lot ALTER COLUMN dossier TYPE character varying(255);
ALTER TABLE lot ALTER COLUMN dossier_autorisation TYPE character varying(255);
ALTER TABLE rapport_instruction ALTER COLUMN dossier_instruction TYPE character varying(255);

--
-- END
--

--
-- BEGIN / Ajout des champs pour stocker la numérotation du dossier
--

ALTER TABLE dossier ADD COLUMN numerotation_type character varying(3) NULL;
ALTER TABLE dossier ADD COLUMN numerotation_dep character varying(3) NULL;
ALTER TABLE dossier ADD COLUMN numerotation_com character varying(3) NULL;
ALTER TABLE dossier ADD COLUMN numerotation_division character varying(2) NULL;
ALTER TABLE dossier ADD COLUMN numerotation_num integer NULL;
ALTER TABLE dossier ADD COLUMN numerotation_suffixe character varying(10) NULL;
ALTER TABLE dossier ADD COLUMN numerotation_num_suffixe integer NULL;
ALTER TABLE dossier ADD COLUMN numerotation_entite character varying(10) NULL;
ALTER TABLE dossier ADD COLUMN numerotation_num_entite integer NULL;

ALTER TABLE dossier_autorisation ADD COLUMN numerotation_type character varying(3) NULL;
ALTER TABLE dossier_autorisation ADD COLUMN numerotation_dep character varying(3) NULL;
ALTER TABLE dossier_autorisation ADD COLUMN numerotation_com character varying(3) NULL;
ALTER TABLE dossier_autorisation ADD COLUMN numerotation_division character varying(2) NULL;
ALTER TABLE dossier_autorisation ADD COLUMN numerotation_num integer NULL;

--
-- END
--

