xudan16 | c7f36a6 | 2022-07-21 17:27:14 +0800 | [diff] [blame] | 1 | /* |
| 2 | * ============LICENSE_START======================================================= |
| 3 | * Copyright (C) 2022 Huawei Technologies Co., Ltd. |
| 4 | * ================================================================================ |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | * |
| 16 | * SPDX-License-Identifier: Apache-2.0 |
| 17 | * ============LICENSE_END========================================================= |
| 18 | */ |
| 19 | |
| 20 | CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; |
| 21 | |
| 22 | create table if not exists intent( |
| 23 | intent_id varchar(255) primary key, |
xudan16 | e1441a7 | 2023-05-25 10:38:28 +0800 | [diff] [blame] | 24 | intent_name varchar(255), |
| 25 | intent_generateType VARCHAR (225) |
xudan16 | c7f36a6 | 2022-07-21 17:27:14 +0800 | [diff] [blame] | 26 | ); |
| 27 | |
| 28 | create table if not exists expectation( |
| 29 | expectation_id varchar(255) primary key, |
| 30 | expectation_name varchar(255), |
| 31 | expectation_type varchar(255), |
| 32 | intent_id varchar(255) |
| 33 | ); |
| 34 | |
| 35 | create table if not exists expectation_object( |
| 36 | object_id varchar(255) DEFAULT uuid_generate_v4 (), |
| 37 | primary key(object_id), |
| 38 | object_type varchar(255), |
| 39 | object_instance varchar(255), |
| 40 | expectation_id varchar(255) |
| 41 | ); |
| 42 | |
| 43 | create table if not exists expectation_target( |
| 44 | target_id varchar(255) primary key, |
| 45 | target_name varchar(255), |
| 46 | expectation_id varchar(255) |
| 47 | ); |
| 48 | |
| 49 | create table if not exists context( |
| 50 | context_id varchar(255) primary key, |
| 51 | context_name varchar(255), |
| 52 | parent_id varchar(255) |
| 53 | ); |
| 54 | |
| 55 | create table if not exists context_mapping( |
| 56 | context_id varchar(255) primary key, |
| 57 | parent_type varchar(255), |
| 58 | parent_id varchar(255) |
| 59 | ); |
| 60 | |
| 61 | create table if not exists fulfilment_info( |
| 62 | fulfilment_info_id varchar(255) primary key, |
| 63 | fulfilment_info_status varchar(255), |
| 64 | not_fulfilled_state varchar(255), |
| 65 | not_fulfilled_reason varchar(255) |
| 66 | ); |
| 67 | |
| 68 | create table if not exists state( |
| 69 | state_id varchar(255) primary key, |
| 70 | state_name varchar(255), |
| 71 | is_satisfied boolean, |
| 72 | condition varchar(255), |
| 73 | expectation_id varchar(255) |
| 74 | ); |
| 75 | |
| 76 | create table if not exists condition( |
| 77 | condition_id varchar(255) primary key, |
| 78 | condition_name varchar(255), |
| 79 | operator_type varchar(255), |
| 80 | condition_value varchar(255), |
| 81 | parent_id varchar(255) |
| 82 | ); |
| 83 | |
| 84 | create table if not exists intent_management_function_reg_info( |
| 85 | imfr_info_id varchar(255) primary key, |
| 86 | imfr_info_description varchar(255), |
| 87 | support_area varchar(255), |
| 88 | support_model varchar(255), |
| 89 | support_interfaces varchar(255), |
| 90 | handle_name varchar(255), |
| 91 | intent_function_type varchar(255) |
| 92 | ); |
xudan16 | e1441a7 | 2023-05-25 10:38:28 +0800 | [diff] [blame] | 93 | |
| 94 | create table if not exists intent_event_record( |
| 95 | id varchar(255) DEFAULT uuid_generate_v4 (), |
| 96 | intent_id varchar(255), |
| 97 | intent_name varchar(255), |
| 98 | intent_status varchar (225), |
| 99 | operate_type varchar (225), |
| 100 | parent_id varchar(255) |
| 101 | ); |
| 102 | |
| 103 | -- ---------------------------- |
| 104 | -- Records of intent_management_function_reg_info |
| 105 | -- ---------------------------- |
| 106 | |
| 107 | insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_area, support_model, support_interfaces, handle_name, intent_function_type) select 'CLLBusinessId','CLLBusiness','CLLBUSINESS',null,'CREATE,DELETE,UPDATE,SEARCH','CLLBusinessIntentManagementFunction','INTERNALFUNCTION' where not exists(select * from intent_management_function_reg_info where imfr_info_id='CLLBusinessId' ) |
| 108 | insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_area, support_model, support_interfaces, handle_name, intent_function_type) select 'CLLDeliveryId','CLLDelivery','CLLBUSINESS,DELIVERY',null,'CREATE,DELETE,UPDATE,SEARCH','CLLDeliveryIntentManagementFunction','INTERNALFUNCTION' where not exists(select * from intent_management_function_reg_info where imfr_info_id='CLLDeliveryId' ) |
| 109 | insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_area, support_model, support_interfaces, handle_name, intent_function_type) select 'CLLAssuranceId','CLLAssurance','CLLBUSINESS,ASSURANCE',null,'CREATE,DELETE,UPDATE,SEARCH','CLLAssuranceIntentManagementFunction','INTERNALFUNCTION' where not exists(select * from intent_management_function_reg_info where imfr_info_id='CLLAssuranceId' ) |
| 110 | |