comparison schema/gemma.sql @ 656:9ef2f80a4645

Fix syntax error in schema script serial is a data type, just like int, and only one can be given. In passing use the standard conforming way to specify the auto-generated column and make it the real primary key.
author Tom Gottfried <tom@intevation.de>
date Fri, 14 Sep 2018 16:57:12 +0200
parents 014ee3beb329
children 40d3b697ea15
comparison
equal deleted inserted replaced
655:014ee3beb329 656:9ef2f80a4645
368 -- XXX: should be 'natsur' according to IENC Encoding Guide M.4.3 368 -- XXX: should be 'natsur' according to IENC Encoding Guide M.4.3
369 PRIMARY KEY (bottleneck_id, riverbed) 369 PRIMARY KEY (bottleneck_id, riverbed)
370 ) 370 )
371 371
372 CREATE TABLE sounding_results ( 372 CREATE TABLE sounding_results (
373 id int serial NOT NULL UNIQUE, 373 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
374 bottleneck_id varchar NOT NULL REFERENCES bottlenecks, 374 bottleneck_id varchar NOT NULL REFERENCES bottlenecks,
375 date_info date NOT NULL, 375 date_info date NOT NULL,
376 PRIMARY KEY (bottleneck_id, date_info), 376 UNIQUE (bottleneck_id, date_info),
377 area geography(POLYGON, 4326), 377 area geography(POLYGON, 4326),
378 surtyp varchar REFERENCES survey_types, 378 surtyp varchar REFERENCES survey_types,
379 coverage varchar REFERENCES coverage_types, 379 coverage varchar REFERENCES coverage_types,
380 depth_reference char(3) NOT NULL REFERENCES depth_references, 380 depth_reference char(3) NOT NULL REFERENCES depth_references,
381 point_cloud geography(MULTIPOINTZ, 4326), 381 point_cloud geography(MULTIPOINTZ, 4326),
383 -- sounding_data raster NOT NULL, 383 -- sounding_data raster NOT NULL,
384 staging_done boolean NOT NULL DEFAULT false 384 staging_done boolean NOT NULL DEFAULT false
385 ) 385 )
386 386
387 CREATE TABLE meshes ( 387 CREATE TABLE meshes (
388 sounding_result_id int NOT NULL REFERENCES sounding_results(id), 388 sounding_result_id int NOT NULL REFERENCES sounding_results,
389 geom geometry(polygonz) NOT NULL 389 geom geometry(polygonz) NOT NULL
390 ) 390 )
391 391
392 CREATE INDEX meshes_gix ON meshes USING gist(geom) 392 CREATE INDEX meshes_gix ON meshes USING gist(geom)
393 393