Skip to content

Commit

Permalink
reflect latest schema changes regarding val_relation_type
Browse files Browse the repository at this point in the history
  • Loading branch information
clausnagel committed Dec 20, 2023
1 parent 37765ae commit 27ef2b7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ SELECT table_name FROM information_schema.tables where table_schema = schema_nam
AND table_name <> 'ade'
AND table_name <> 'datatype'
AND table_name <> 'database_srs'
AND table_name <> 'aggregation_info'
AND table_name <> 'codelist'
AND table_name <> 'codelist_entry'
AND table_name <> 'namespace'
Expand Down Expand Up @@ -154,7 +153,7 @@ BEGIN
RETURNING
p.id,
p.val_feature_id,
p.val_reference_type,
p.val_relation_type,
p.val_geometry_id,
p.val_implicitgeom_id,
p.val_appearance_id,
Expand All @@ -177,7 +176,7 @@ BEGIN
FROM
property_ids
WHERE
val_feature_id IS NULL OR val_reference_type IS NULL OR val_reference_type = 1;
val_feature_id IS NULL OR val_relation_type = 1;

IF -1 = ALL(feature_ids) IS NOT NULL THEN
PERFORM
Expand All @@ -187,7 +186,7 @@ BEGIN
LEFT JOIN
property p
ON p.val_feature_id = a.a_id
WHERE p.val_feature_id IS NULL OR p.val_reference_type = 2;
WHERE p.val_feature_id IS NULL OR p.val_relation_type IS NULL OR p.val_relation_type = 0;
END IF;

IF -1 = ALL(geometry_ids) IS NOT NULL THEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ BEGIN
FROM
property p
WHERE
p.id = fid AND p.val_feature_id IS NOT NULL AND p.val_reference_type <> 2
p.id = fid AND p.val_feature_id IS NOT NULL AND p.val_relation_type = 1
LOOP
bbox_tmp := citydb_pkg.get_feature_envelope(rec.id::bigint, set_envelope, schema_name);
bbox := citydb_pkg.update_bounds(bbox, bbox_tmp, schema_name);
Expand Down
1 change: 0 additions & 1 deletion resources/3dcitydb/postgresql/SQLScripts/CREATE_DB.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ SET search_path TO citydb, :current_path;
\ir SCHEMA/METADATA/NAMESPACE_INSTANCES.sql
\ir SCHEMA/METADATA/DATATYPE_INSTANCES.sql
\ir SCHEMA/METADATA/OBJECTCLASS_INSTANCES.sql
\ir SCHEMA/METADATA/AGGREGATION_INFO_INSTANCES.sql

--// fill codelist tables
\ir SCHEMA/CODELIST/CODELIST_INSTANCES.sql
Expand Down

This file was deleted.

27 changes: 2 additions & 25 deletions resources/3dcitydb/postgresql/SQLScripts/SCHEMA/SCHEMA.sql
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,6 @@ CREATE TABLE tex_image (
CONSTRAINT tex_image_pk PRIMARY KEY ( id )
);

CREATE TABLE aggregation_info (
child_id integer NOT NULL ,
parent_id integer NOT NULL ,
property_name text NOT NULL ,
property_namespace_id integer ,
min_occurs integer ,
max_occurs integer ,
is_composite numeric
);

CREATE INDEX aggregation_info_child_fkx ON aggregation_info ( child_id );

CREATE INDEX aggregation_info_parent_fkx ON aggregation_info ( parent_id );

CREATE INDEX aggregation_info_namespace_fkx ON aggregation_info ( property_namespace_id );

CREATE TABLE appearance (
id bigint DEFAULT nextval('appearance_seq'::regclass) NOT NULL ,
objectid text ,
Expand Down Expand Up @@ -237,7 +221,7 @@ CREATE TABLE property (
val_appearance_id bigint ,
val_address_id bigint ,
val_feature_id bigint ,
val_reference_type integer ,
val_relation_type integer ,
val_content text ,
val_content_mime_type text ,
CONSTRAINT property_pk PRIMARY KEY ( id )
Expand Down Expand Up @@ -271,7 +255,7 @@ CREATE INDEX property_val_appearance_fkx ON property ( val_appearance_id );

CREATE INDEX property_namespace_inx ON property ( namespace_id );

CREATE INDEX property_val_reference_inx ON property ( val_reference_type );
CREATE INDEX property_val_relation_type_inx ON property ( val_relation_type );

CREATE INDEX property_val_address_fkx ON property ( val_address_id );

Expand Down Expand Up @@ -322,20 +306,13 @@ CREATE TABLE appear_to_surface_data (
id bigint DEFAULT nextval('appear_to_surface_data_seq'::regclass) NOT NULL ,
appearance_id bigint NOT NULL ,
surface_data_id bigint ,
val_reference_type integer ,
CONSTRAINT appear_to_surface_data_pk PRIMARY KEY ( id )
);

CREATE INDEX appear_to_surface_data_fkx1 ON appear_to_surface_data ( surface_data_id );

CREATE INDEX appear_to_surface_data_fkx2 ON appear_to_surface_data ( appearance_id );

ALTER TABLE aggregation_info ADD CONSTRAINT aggregation_info_child_fk FOREIGN KEY ( child_id ) REFERENCES objectclass( id ) ON DELETE CASCADE;

ALTER TABLE aggregation_info ADD CONSTRAINT aggregation_info_parent_fk FOREIGN KEY ( parent_id ) REFERENCES objectclass( id ) ON DELETE CASCADE;

ALTER TABLE aggregation_info ADD CONSTRAINT aggregation_info_namespace_fk FOREIGN KEY ( property_namespace_id ) REFERENCES namespace( id ) ON DELETE CASCADE;

ALTER TABLE appear_to_surface_data ADD CONSTRAINT appear_to_surface_data_fk1 FOREIGN KEY ( surface_data_id ) REFERENCES surface_data( id ) ON DELETE CASCADE;

ALTER TABLE appear_to_surface_data ADD CONSTRAINT appear_to_surface_data_fk2 FOREIGN KEY ( appearance_id ) REFERENCES appearance( id ) ON DELETE CASCADE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ SELECT version as citydb_version from citydb_pkg.citydb_version();
\ir ../../SCHEMA/METADATA/NAMESPACE_INSTANCES.sql
\ir ../../SCHEMA/METADATA/OBJECTCLASS_INSTANCES.sql
\ir ../../SCHEMA/METADATA/DATATYPE_INSTANCES.sql
\ir ../../SCHEMA/METADATA/AGGREGATION_INFO_INSTANCES.sql

--// fill codelist tables
\ir ../../SCHEMA/CODELIST/CODELIST_INSTANCES.sql
Expand Down

0 comments on commit 27ef2b7

Please sign in to comment.