wiki:dbeel

Version 10 (modified by cedric, 14 years ago) (diff)

--

back to first page ..

Scripts de creation ONEMA

inserting BDMAP

I already have a dump of the BDMAP somewhere so I'm just saving it and will use it to insert data into the debile.

sauvegarde
cd C:\eda\backup
C:\"Program Files"\PostgreSQL\8.4\bin\pg_dump  -U postgres -p 5433 --schema=bdmap BDMAP> bdmap.bdmap.sql
restauration
C:\"Program Files"\PostgreSQL\8.4\bin\psql -U postgres -d dbeel -p 5433 -f bdmap.bdmap.sql
DROP TABLE if exists "onema".station_onema CASCADE;
CREATE TABLE "onema".station_onema (
        LIKE bdmap.station,
        CONSTRAINT station_onema_id PRIMARY KEY (op_id),
        CONSTRAINT station_onema_fk_observation_place_type_id FOREIGN KEY (op_no_observationplacetype) 
        REFERENCES "dbeel_nomenclature".observation_place_type (no_id) 
        MATCH SIMPLE ON UPDATE CASCADE ON DELETE RESTRICT
) INHERITS ("dbeel".observation_places);
-- TODO: insert trigger

INSERT INTO "onema".station_onema
        SELECT  uuid_generate_v4() as op_id,
        'onema' as op_gis_systemname ,
        'BDMAP' as op_gis_layername, 
        s.st_id as op_gislocation,
        s.st_localisation as op_placename,
        10 as op_no_observationplacetype, -- Sampling station
        NULL as  op_op_id,
        s.* FROM bdmap.station s ;