Convert license header to SQL comment
[policy/engine.git] / packages / base / src / files / install / mysql / data / 180601_upgrade_script.sql
1 -- ============LICENSE_START=======================================================
2 -- ONAP Policy Engine
3 -- ================================================================================
4 -- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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 -- ============LICENSE_END=========================================================
18
19 use onap_sdk;
20
21 drop table if exists `onap_sdk`.`optimizationmodels`;
22 create table `onap_sdk`.`optimizationmodels` (
23 `id` int(11) not null auto_increment,
24 `modelname` varchar(767) not null,
25 `description` varchar(1024) default null,
26 `dependency` varchar(1024) default null,
27 `imported_by` varchar(45) not null,
28 `attributes` longtext,
29 `ref_attributes` longtext,
30 `sub_attributes` longtext,
31 `version` varchar(45) default null,
32 `annotation` longtext,
33 `enumValues` longtext, 
34 `dataOrderInfo` varchar(2000) DEFAULT NULL,
35 primary key (`id`),
36 unique key `optimizationmodels_uniq` (`modelname`,`version`)
37 );
38
39 drop table if exists `onap_sdk`.`MicroServiceHeaderDefaults`;
40 CREATE TABLE `onap_sdk`.`MicroServiceHeaderDefaults` (
41   `ID` int(11) NOT NULL AUTO_INCREMENT,
42   `onapName` varchar(255) DEFAULT NULL,
43   `guard` varchar(255) DEFAULT NULL,
44   `priority` varchar(3) DEFAULT NULL,
45   `riskType` varchar(255) DEFAULT NULL,  
46   `riskLevel` varchar(3) DEFAULT NULL,   
47   `modelName` varchar(1024) NOT NULL,
48   PRIMARY KEY (`ID`)
49 );
50
51 ALTER TABLE `onap_sdk`.`microservicemodels` 
52 ADD COLUMN `dataOrderInfo` VARCHAR(2000) NULL DEFAULT 'Null' AFTER `enumValues`;
53
54 INSERT INTO `onap_sdk`.`optimizationmodels` (`modelname`, `description`, `dependency`, `imported_by`, `attributes`, `ref_attributes`, `sub_attributes`, `version`, `annotation`, `enumValues`, `dataOrderInfo`) VALUES ('hpaPolicy', 'CSIT Tests Model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false,resources=string:defaultValue-null:required-true:MANY-false', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,flavorFeatures=flavorFeatures-properties:MANY-true', '{\"flavorProperties-properties\":{\"score\":\"string:defaultValue-null:required-true:MANY-false\",\"featureAttributes\":\"featureAttributes-properties:required-false:MANY-true\",\"mandatory\":\"string:defaultValue-null:required-true:MANY-false\",\"hpaFeature\":\"string:defaultValue-null:required-true:MANY-false\",\"architecture\":\"string:defaultValue-null:required-true:MANY-false\"},\"flavorFeatures-properties\":{\"flavorProperties\":\"flavorProperties-properties:required-false:MANY-true\",\"flavorLabel\":\"string:defaultValue-null:required-true:MANY-false\"},\"featureAttributes-properties\":{\"unit\":\"string:defaultValue-null:required-true:MANY-false\",\"attribute\":\"string:defaultValue-null:required-true:MANY-false\",\"value\":\"string:defaultValue-null:required-true:MANY-false\",\"operator\":\"OPERATOR:required-true:MANY-false\"}}\n', 'CSIT', 'policyScope=matching-true', 'OPERATOR=[<,<equal-sign,>,>equal-sign,equal-sign,!equal-sign,any,all,subset,], POLICYTYPE=[hpaPolicy,]', '\"[resources,identity,policyScope,policyType,flavorFeatures,flavorLabel,flavorProperties,architecture,hpaFeature,mandatory,score,featureAttributes,attribute,operator,unit,value]\"');
55