1f554a047ea3ef11e56cdd681d252c370f50eb85
[smo/teiv.git] /
1 --
2 -- ============LICENSE_START=======================================================
3 -- Copyright (C) 2024 Ericsson
4 -- Modifications Copyright (C) 2024 OpenInfra Foundation Europe
5 -- ================================================================================
6 -- Licensed under the Apache License, Version 2.0 (the "License");
7 -- you may not use this file except in compliance with the License.
8 -- You may obtain a copy of the License at
9 --
10 --       http://www.apache.org/licenses/LICENSE-2.0
11 --
12 -- Unless required by applicable law or agreed to in writing, software
13 -- distributed under the License is distributed on an "AS IS" BASIS,
14 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 -- See the License for the specific language governing permissions and
16 -- limitations under the License.
17 --
18 -- SPDX-License-Identifier: Apache-2.0
19 -- ============LICENSE_END=========================================================
20 --
21
22 BEGIN;
23
24 DROP SCHEMA IF EXISTS ties_model cascade;
25 CREATE SCHEMA IF NOT EXISTS ties_model;
26 ALTER SCHEMA ties_model OWNER TO :pguser;
27 SET default_tablespace = '';
28 SET default_table_access_method = heap;
29
30 SET ROLE :'pguser';
31
32 CREATE TABLE IF NOT EXISTS ties_model.execution_status (
33     "schema"                 VARCHAR(127) PRIMARY KEY,
34     "status"          VARCHAR(127)
35 );
36
37 CREATE TABLE IF NOT EXISTS ties_model.hash_info (
38     "name"                 VARCHAR(511) PRIMARY KEY,
39     "hashedValue"          VARCHAR(511),
40     "type"                 VARCHAR(511)
41 );
42
43 CREATE TABLE IF NOT EXISTS ties_model.module_reference (
44     "name"                   VARCHAR(511) PRIMARY KEY,
45     "namespace"              VARCHAR(511),
46     "domain"             VARCHAR(511),
47     "includedModules"        jsonb,
48     "revision"       VARCHAR(511),
49     "content"               TEXT
50 );
51
52 CREATE TABLE IF NOT EXISTS ties_model.entity_info (
53     "storedAt"            VARCHAR(511) PRIMARY KEY,
54     "name"                VARCHAR(511) NOT NULL,
55     "moduleReferenceName" VARCHAR(511) NOT NULL,
56     FOREIGN KEY ("moduleReferenceName") REFERENCES ties_model.module_reference ("name") ON DELETE CASCADE
57 );
58
59 CREATE TABLE IF NOT EXISTS ties_model.relationship_info (
60     "name"                     VARCHAR(511) NOT NULL,
61     "aSideAssociationName"     TEXT NOT NULL,
62     "aSideMOType"              TEXT NOT NULL,
63     "aSideModule"              TEXT NOT NULL,
64     "aSideMinCardinality"      BIGINT NOT NULL,
65     "aSideMaxCardinality"      BIGINT NOT NULL,
66     "bSideAssociationName"     TEXT NOT NULL,
67     "bSideMOType"              TEXT NOT NULL,
68     "bSideModule"              TEXT NOT NULL,
69     "bSideMinCardinality"      BIGINT NOT NULL,
70     "bSideMaxCardinality"      BIGINT NOT NULL,
71     "associationKind"          TEXT NOT NULL,
72     "relationshipDataLocation" TEXT NOT NULL,
73     "connectSameEntity"        BOOLEAN NOT NULL,
74     "storedAt"                 VARCHAR(511) NOT NULL,
75     "moduleReferenceName"      TEXT NOT NULL,
76     PRIMARY KEY ("name", "moduleReferenceName"),
77     FOREIGN KEY ("moduleReferenceName") REFERENCES ties_model.module_reference ("name") ON DELETE CASCADE
78 );
79
80 -- Update model schema exec status
81 INSERT INTO ties_model.execution_status("schema", "status") VALUES ('ties_model', 'success');
82
83 COPY ties_model.hash_info("name", "hashedValue", "type") FROM stdin;
84 \.
85
86 COPY ties_model.module_reference("name", "namespace", "domain", "includedModules", "revision", "content") FROM stdin;
87 \.
88
89 COPY ties_model.entity_info("storedAt", "name", "moduleReferenceName") FROM stdin;
90 \.
91
92 COPY ties_model.relationship_info("name", "aSideAssociationName", "aSideMOType", "aSideModule", "aSideMinCardinality", "aSideMaxCardinality", "bSideAssociationName", "bSideMOType", "bSideModule", "bSideMinCardinality", "bSideMaxCardinality", "associationKind", "connectSameEntity", "relationshipDataLocation", "storedAt", "moduleReferenceName") FROM stdin;
93 ENODEBFUNCTION_PROVIDES_LTESECTORCARRIER        provided-lteSectorCarrier       ENodeBFunction  o-ran-smo-teiv-ran      1       1       provided-by-enodebFunction      LTESectorCarrier        o-ran-smo-teiv-ran      0       100     BI_DIRECTIONAL  false   B_SIDE  o-ran-smo-teiv-ran:LTESectorCarrier     o-ran-smo-teiv-ran
94 LTESECTORCARRIER_USES_ANTENNACAPABILITY used-antennaCapability  LTESectorCarrier        o-ran-smo-teiv-ran      0       9223372036854775807     used-by-lteSectorCarrier        AntennaCapability       o-ran-smo-teiv-ran      0       1       BI_DIRECTIONAL  false   A_SIDE  o-ran-smo-teiv-ran:LTESectorCarrier     o-ran-smo-teiv-ran
95 \.
96
97 ;
98
99 COMMIT;