diff options
author | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2020-11-24 11:13:43 +0200 |
---|---|---|
committer | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2020-12-03 15:59:03 +0200 |
commit | cb03544962c994c0cc9d9117a3c6b9182ce22204 (patch) | |
tree | 7fdec9f545c81c55e93376a7d58e6a648d994550 /cps-ri/src/main/resources/schema.sql | |
parent | 35b2b4414405c0c3f7c06171ae0e1ebca3214e40 (diff) |
Schema Set persistence (store) implementation
Issue-ID: CPS-92
Change-Id: I11257726e4f847e3337d8bafad824853e6a458e2
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-ri/src/main/resources/schema.sql')
-rwxr-xr-x | cps-ri/src/main/resources/schema.sql | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/cps-ri/src/main/resources/schema.sql b/cps-ri/src/main/resources/schema.sql index 3fabc6c9f9..d47f261add 100755 --- a/cps-ri/src/main/resources/schema.sql +++ b/cps-ri/src/main/resources/schema.sql @@ -17,6 +17,30 @@ CREATE TABLE IF NOT EXISTS SCHEMA_NODE ID SERIAL PRIMARY KEY
);
+CREATE TABLE IF NOT EXISTS SCHEMA_SET
+(
+ ID SERIAL PRIMARY KEY,
+ NAME TEXT NOT NULL,
+ DATASPACE_ID BIGINT NOT NULL,
+ UNIQUE (NAME, DATASPACE_ID),
+ CONSTRAINT SCHEMA_SET_DATASPACE FOREIGN KEY (DATASPACE_ID) REFERENCES DATASPACE(ID) ON UPDATE CASCADE ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS YANG_RESOURCE
+(
+ ID SERIAL PRIMARY KEY,
+ CHECKSUM TEXT NOT NULL,
+ CONTENT TEXT NOT NULL,
+ UNIQUE (CHECKSUM)
+);
+
+CREATE TABLE IF NOT EXISTS SCHEMA_SET_YANG_RESOURCES
+(
+ SCHEMA_SET_ID BIGINT NOT NULL,
+ YANG_RESOURCE_ID BIGINT NOT NULL REFERENCES YANG_RESOURCE(ID),
+ CONSTRAINT SCHEMA_SET_RESOURCE FOREIGN KEY (SCHEMA_SET_ID) REFERENCES SCHEMA_SET(ID) ON DELETE CASCADE
+);
+
CREATE TABLE IF NOT EXISTS MODULE
(
ID SERIAL PRIMARY KEY,
@@ -62,4 +86,4 @@ CREATE INDEX IF NOT EXISTS "FKI_RELATION_TYPE_ID_FK" ON RELATION USING CREATE INDEX IF NOT EXISTS "FKI_RELATIONS_FROM_ID_FK" ON RELATION USING BTREE(FROM_FRAGMENT_ID);
CREATE INDEX IF NOT EXISTS "FKI_RELATIONS_TO_ID_FK" ON RELATION USING BTREE(TO_FRAGMENT_ID);
CREATE INDEX IF NOT EXISTS "PERF_MODULE_MODULE_CONTENT" ON MODULE USING BTREE(MODULE_CONTENT);
-CREATE UNIQUE INDEX IF NOT EXISTS "UQ_FRAGMENT_XPATH"ON FRAGMENT USING btree(xpath COLLATE pg_catalog."default" text_pattern_ops, dataspace_id);
\ No newline at end of file +CREATE UNIQUE INDEX IF NOT EXISTS "UQ_FRAGMENT_XPATH"ON FRAGMENT USING btree(xpath COLLATE pg_catalog."default" text_pattern_ops, dataspace_id);
|