SET client_encoding = 'utf-8';
SET standard_conforming_strings = OFF;
DROP TABLE IF EXISTS "erp" CASCADE;
BEGIN;
CREATE TABLE "erp"();
SELECT AddGeometryColumn('erp','geometrie',2972,'GEOMETRY',2);
CREATE INDEX "erp_geometrie_geom_idx" ON "erp" USING GIST ("geometrie");
ALTER TABLE "erp" ADD COLUMN "cleabs" VARCHAR(24);
ALTER TABLE "erp" ADD COLUMN "id_reference" VARCHAR(24);
ALTER TABLE "erp" ADD COLUMN "categorie" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "type_principal" VARCHAR(24);
ALTER TABLE "erp" ADD COLUMN "types_secondaires" VARCHAR(24);
ALTER TABLE "erp" ADD COLUMN "activite_principale" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "activites_secondaires" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "libelle" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "etat_de_l_objet" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "date_creation" timestamp with time zone;
ALTER TABLE "erp" ADD COLUMN "date_modification" timestamp with time zone;
ALTER TABLE "erp" ADD COLUMN "date_d_apparition" date;
ALTER TABLE "erp" ADD COLUMN "date_de_confirmation" date;
ALTER TABLE "erp" ADD COLUMN "sources" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "identifiants_sources" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "precision_planimetrique" NUMERIC(5,1);
ALTER TABLE "erp" ADD COLUMN "public" BOOLEAN;
ALTER TABLE "erp" ADD COLUMN "ouvert" BOOLEAN;
ALTER TABLE "erp" ADD COLUMN "capacite_d_accueil_du_public" INTEGER;
ALTER TABLE "erp" ADD COLUMN "capacite_d_hebergement" INTEGER;
ALTER TABLE "erp" ADD COLUMN "origine_de_la_geometrie" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "type_de_localisation" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "validation_ign" BOOLEAN;
ALTER TABLE "erp" ADD COLUMN "insee_commune" VARCHAR(5);
ALTER TABLE "erp" ADD COLUMN "numero_siret" VARCHAR(14);
ALTER TABLE "erp" ADD COLUMN "adresse_numero" VARCHAR(15);
ALTER TABLE "erp" ADD COLUMN "adresse_indice_de_repetition" VARCHAR(9);
ALTER TABLE "erp" ADD COLUMN "adresse_designation_de_l_entree" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "adresse_nom_1" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "adresse_nom_2" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "code_postal" VARCHAR(5);
ALTER TABLE "erp" ADD COLUMN "liens_vers_batiment" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "liens_vers_enceinte" VARCHAR;
ALTER TABLE "erp" ADD COLUMN "liens_vers_adresse" VARCHAR;
COMMIT;
SET standard_conforming_strings = OFF;
BEGIN;
COPY "erp" ("geometrie", "cleabs", "id_reference", "categorie", "type_principal", "types_secondaires", "activite_principale", "activites_secondaires", "libelle", "etat_de_l_objet", "date_creation", "date_modification", "date_d_apparition", "date_de_confirmation", "sources", "identifiants_sources", "precision_planimetrique", "public", "ouvert", "capacite_d_accueil_du_public", "capacite_d_hebergement", "origine_de_la_geometrie", "type_de_localisation", "validation_ign", "insee_commune", "numero_siret", "adresse_numero", "adresse_indice_de_repetition", "adresse_designation_de_l_entree", "adresse_nom_1", "adresse_nom_2", "code_postal", "liens_vers_batiment", "liens_vers_enceinte", "liens_vers_adresse") FROM STDIN;
01010000209C0B0000CDCCCCCC68FF06413333333316E12241	ERP_____0000002275442995	\N	\N	\N	\N	\N	\N	\N	En service	2021/12/09 18:20:36.461	\N	\N	\N	\N	\N	2.5	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N
01010000209C0B000000000000F6031641333333330F571D41	ERP_____0000002275442896	\N	\N	\N	\N	\N	\N	\N	En service	2021/12/09 18:17:35.646	\N	\N	\N	\N	\N	9999.0	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N
\.
END;
COMMIT;
