diff options
author | 2021-02-23 15:51:00 +0000 | |
---|---|---|
committer | 2021-02-24 10:10:34 +0000 | |
commit | 495ae8e49f0131bf461ea52baa87004c39f40bd3 (patch) | |
tree | 667898db10d46db52617e92157c13781537c3796 /cps-ri/src/main/resources/schema.sql | |
parent | 861ecab596c548d77cc18f1581a992159ada82ee (diff) |
Schema creation and Data pre-load to on cps-xnf-proxy start-up using liquibase
1. Common change-log master used only to specify the different change sets.
2. Specific change set created for cpsTables creation and for loading data to each cps component like dataspace, schema-set, anchor and dataNode
3. The data load cabability is configurable in the sense, it will be trigered only if the label is specified in the application.yaml
Issue-ID: CPS-173, CPS-242
Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca>
Change-Id: I44c640ce50b7203f5799d722149397478a98bc05
Diffstat (limited to 'cps-ri/src/main/resources/schema.sql')
-rwxr-xr-x | cps-ri/src/main/resources/schema.sql | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/cps-ri/src/main/resources/schema.sql b/cps-ri/src/main/resources/schema.sql deleted file mode 100755 index 2735ca489..000000000 --- a/cps-ri/src/main/resources/schema.sql +++ /dev/null @@ -1,85 +0,0 @@ -CREATE TABLE IF NOT EXISTS RELATION_TYPE
-(
- RELATION_TYPE TEXT NOT NULL,
- ID SERIAL PRIMARY KEY
-);
-
-CREATE TABLE IF NOT EXISTS DATASPACE
-(
- ID SERIAL PRIMARY KEY,
- NAME TEXT NOT NULL,
- CONSTRAINT "UQ_NAME" UNIQUE (NAME)
-);
-
-CREATE TABLE IF NOT EXISTS SCHEMA_NODE
-(
- SCHEMA_NODE_IDENTIFIER TEXT NOT NULL,
- 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,
- NAME TEXT NOT NULL,
- CONTENT TEXT NOT NULL,
- CHECKSUM 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 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_ID BIGINT REFERENCES ANCHOR(ID),
- PARENT_ID BIGINT REFERENCES FRAGMENT(ID),
- DATASPACE_ID INTEGER NOT NULL REFERENCES DATASPACE(ID),
- SCHEMA_NODE_ID INTEGER REFERENCES SCHEMA_NODE(ID),
- UNIQUE (DATASPACE_ID, ANCHOR_ID, XPATH)
-);
-
-CREATE TABLE IF NOT EXISTS RELATION
-(
- FROM_FRAGMENT_ID BIGINT NOT NULL REFERENCES FRAGMENT(ID),
- TO_FRAGMENT_ID BIGINT NOT NULL REFERENCES FRAGMENT(ID),
- RELATION_TYPE_ID INTEGER NOT NULL REFERENCES RELATION_TYPE(ID),
- FROM_REL_XPATH TEXT NOT NULL,
- TO_REL_XPATH TEXT NOT NULL,
- CONSTRAINT RELATION_PKEY PRIMARY KEY (TO_FRAGMENT_ID, FROM_FRAGMENT_ID, RELATION_TYPE_ID)
-);
-
-CREATE INDEX IF NOT EXISTS "FKI_FRAGMENT_DATASPACE_ID_FK" ON FRAGMENT USING BTREE(DATASPACE_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);
-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 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 |