summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ri/src/main/resources')
-rwxr-xr-xcps-ri/src/main/resources/schema.sql17
1 files changed, 12 insertions, 5 deletions
diff --git a/cps-ri/src/main/resources/schema.sql b/cps-ri/src/main/resources/schema.sql
index 58b3c63c82..d37d932aad 100755
--- a/cps-ri/src/main/resources/schema.sql
+++ b/cps-ri/src/main/resources/schema.sql
@@ -53,18 +53,25 @@ CREATE TABLE IF NOT EXISTS MODULE
CONSTRAINT MODULE_DATASPACE FOREIGN KEY (DATASPACE_ID) REFERENCES DATASPACE (id) ON UPDATE CASCADE ON DELETE CASCADE
);
+CREATE TABLE IF NOT EXISTS ANCHOR
+(
+ ID BIGSERIAL PRIMARY KEY,
+ NAME TEXT,
+ SCHEMA_SET_ID INTEGER REFERENCES SCHEMA_SET(ID),
+ DATASPACE_ID INTEGER NOT NULL REFERENCES DATASPACE(ID),
+ UNIQUE (DATASPACE_ID, NAME)
+);
+
CREATE TABLE IF NOT EXISTS FRAGMENT
(
ID BIGSERIAL PRIMARY KEY,
XPATH TEXT NOT NULL,
ATTRIBUTES JSONB,
- ANCHOR_NAME TEXT,
- ANCHOR_ID BIGINT REFERENCES FRAGMENT(ID),
+ ANCHOR_ID BIGINT REFERENCES ANCHOR(ID),
PARENT_ID BIGINT REFERENCES FRAGMENT(ID),
- SCHEMA_SET_ID INTEGER REFERENCES SCHEMA_SET(ID),
DATASPACE_ID INTEGER NOT NULL REFERENCES DATASPACE(ID),
SCHEMA_NODE_ID INTEGER REFERENCES SCHEMA_NODE(ID),
- UNIQUE (DATASPACE_ID, ANCHOR_NAME, XPATH)
+ UNIQUE (DATASPACE_ID, ANCHOR_ID, XPATH)
);
CREATE TABLE IF NOT EXISTS RELATION
@@ -78,9 +85,9 @@ CREATE TABLE IF NOT EXISTS RELATION
);
CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_DATASPACE_ID_FK" ON FRAGMENT USING BTREE(DATASPACE_ID) ;
-CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_SCHEMA_SET_ID_FK" ON FRAGMENT USING BTREE(SCHEMA_SET_ID) ;
CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_PARENT_ID_FK" ON FRAGMENT USING BTREE(PARENT_ID) ;
CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_ANCHOR_ID_FK" ON FRAGMENT USING BTREE(ANCHOR_ID) ;
+CREATE INDEX IF NOT EXISTS "FKI_ANCHOR_SCHEMA_SET_ID_FK" ON ANCHOR USING BTREE(SCHEMA_SET_ID) ;
CREATE INDEX IF NOT EXISTS "PERF_SCHEMA_NODE_SCHEMA_NODE_ID" ON SCHEMA_NODE USING BTREE(SCHEMA_NODE_IDENTIFIER) ;
CREATE INDEX IF NOT EXISTS "FKI_SCHEMA_NODE_ID_TO_ID" ON FRAGMENT USING BTREE(SCHEMA_NODE_ID) ;
CREATE INDEX IF NOT EXISTS "FKI_RELATION_TYPE_ID_FK" ON RELATION USING BTREE(RELATION_TYPE_ID);