| 23 | {{{ |
| 24 | !#sql |
| 25 | DROP TABLE if exists "onema".station_onema CASCADE; |
| 26 | CREATE TABLE "onema".station_onema ( |
| 27 | LIKE bdmap.station, |
| 28 | CONSTRAINT station_onema_id PRIMARY KEY (op_id), |
| 29 | CONSTRAINT station_onema_fk_observation_place_type_id FOREIGN KEY (op_no_observationplacetype) |
| 30 | REFERENCES "dbeel_nomenclature".observation_place_type (no_id) |
| 31 | MATCH SIMPLE ON UPDATE CASCADE ON DELETE RESTRICT |
| 32 | ) INHERITS ("dbeel".observation_places); |
| 33 | -- TODO: insert trigger |
| 34 | |
| 35 | INSERT INTO "onema".station_onema |
| 36 | SELECT uuid_generate_v4() as op_id, |
| 37 | 'onema' as op_gis_systemname , |
| 38 | 'BDMAP' as op_gis_layername, |
| 39 | s.st_id as op_gislocation, |
| 40 | s.st_localisation as op_placename, |
| 41 | 10 as op_no_observationplacetype, -- Sampling station |
| 42 | NULL as op_op_id, |
| 43 | s.* FROM bdmap.station s ; |
| 44 | }}} |