GLE-Postgis-Naturschutzgutachten
Aus kvwmap
CREATE TABLE naturschutzgutachten ( id serial NOT NULL, titel character varying(255) NOT NULL, verfasser character varying, erstellungsjahr smallint, ablage character varying, bemerkungen text ) WITH ( OIDS=TRUE ); SELECT AddGeometryColumn('public', 'naturschutzgutachten','the_geom',25833,'POLYGON', 2); ALTER TABLE naturschutzgutachten DROP CONSTRAINT enforce_geotype_the_geom; ALTER TABLE naturschutzgutachten ADD CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POLYGON'::text OR geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL); ALTER TABLE naturschutzgutachten ADD CONSTRAINT pk_id PRIMARY KEY(id); CREATE TABLE naturschutzgutachten_artengruppe ( id integer NOT NULL, bezeichnung character varying NOT NULL ) WITH ( OIDS=TRUE ); ALTER TABLE naturschutzgutachten_artengruppe ADD CONSTRAINT fk_ag_id FOREIGN KEY (id) REFERENCES naturschutzgutachten (id) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE CASCADE; CREATE TABLE naturschutzgutachten_dokumente ( id integer NOT NULL, dokument character varying NOT NULL ) WITH ( OIDS=TRUE ); ALTER TABLE naturschutzgutachten_dokumente ADD CONSTRAINT fk_doc_id FOREIGN KEY (id) REFERENCES naturschutzgutachten (id) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE CASCADE;