aboutsummaryrefslogtreecommitdiffstats
path: root/standalone/src/main/assembly/resources
diff options
context:
space:
mode:
authorshentao999 <shentao@chinamobile.com>2019-04-10 14:38:03 +0800
committerzhangab <zhanganbing@chinamobile.com>2019-04-10 14:46:32 +0800
commit8e96605c2a4301a7c8e7bb5b1a2a4bc0b26daa34 (patch)
treec58d0fe88a627daa9e04f92dee8229adc539b7a8 /standalone/src/main/assembly/resources
parentacdda859b080784e3c02cc8b3c31ef0ef3f2847e (diff)
Change database to postgreSQL9.5
Change-Id: I859d0ae4173d41e1055d88518aac0f9a7f50d01a Issue-ID: USECASEUI-236 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
Diffstat (limited to 'standalone/src/main/assembly/resources')
-rw-r--r--standalone/src/main/assembly/resources/bin/initDB.sh50
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql26
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql149
3 files changed, 198 insertions, 27 deletions
diff --git a/standalone/src/main/assembly/resources/bin/initDB.sh b/standalone/src/main/assembly/resources/bin/initDB.sh
index 06d2bfc8..a7ee1eed 100644
--- a/standalone/src/main/assembly/resources/bin/initDB.sh
+++ b/standalone/src/main/assembly/resources/bin/initDB.sh
@@ -15,36 +15,32 @@
# limitations under the License.
#
-DIRNAME=`dirname $0`
-HOME=`cd $DIRNAME/; pwd`
+echo "setting database init parameters"
+main_path="/home/uui"
user=$1
password=$2
-port=$3
-host=$4
-echo "start create usecase-ui db"
-sql_path=$HOME/../
-mysql -u$user -p$password -P$port -h$host <$sql_path/dbscripts/mysql/usecase-ui-createdb.sql
+host=$3
+port=$4
+dbname=$5
+
+echo "start create usecase-ui database..."
+dbscripts_path="$main_path/resources/dbscripts/postgres"
+psql "host=$host port=$port user=$user password=$password dbname=$dbname" -f $dbscripts_path/uui_create_db.sql
sql_result=$?
-if [ $sql_result != 0 ] ; then
- echo "failed to create usecase-ui database"
+if [ $sql_result!=0 ] then
+ echo "failed to create usecase-ui database!"
exit 1
+else
+ echo "usecase-ui database created successfully!"
fi
-fileFlag=*createobj.sql
-location=$sql_path/dbscripts/mysql
-fileName=""
-for i in `ls $location`
-do
- if [[ $i == ${fileFlag} ]];then
- fileName=${i};
- echo "start create table:${fileName}"
- mysql -u$user -p$password -P$port -h$host <$sql_path/dbscripts/mysql/$fileName
- sql_result=$?
- if [ $sql_result != 0 ] ; then
- echo "failed to init usecase-ui table:${fileName}"
- exit 1
- fi
- fi
-done
-echo "init usecase-ui database success!"
-exit 0
+echo "start create usecase-ui tables..."
+psql "host=$host port=$port user=$user password=$password dbname=$dbname" -f $dbscripts_path/uui_create_table.sql
+sql_result=$?
+if [ $sql_result!=0 ] then
+ echo "failed to create usecase-ui table!"
+ exit 1
+else
+ echo "usecase-ui tables created successfully!"
+fi
+exit 0
diff --git a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql
new file mode 100644
index 00000000..49e9e593
--- /dev/null
+++ b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql
@@ -0,0 +1,26 @@
+--
+-- Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+-- create uui user
+create user "uui" with password 'uui' nocreatedb;
+
+-- create uui database
+drop database if exists uui;
+create database uui with owner uui template template0 encoding 'UTF8';
+
+-- grant uui create uui user
+grant all privileges on database uui to uui;
+grant all privileges on database uui to postgres;
diff --git a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql
new file mode 100644
index 00000000..a62d0835
--- /dev/null
+++ b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql
@@ -0,0 +1,149 @@
+--
+-- Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+-- ----------------------------
+-- Table structure for "alarms_additionalinformation"
+-- ----------------------------
+DROP TABLE alarms_additionalinformation;
+CREATE TABLE alarms_additionalinformation(
+ id serial,
+ "header_id" varchar(50) NOT NULL,
+ "name" varchar(100) DEFAULT NULL,
+ "value" varchar(100) DEFAULT NULL,
+ "source_id" varchar(100) DEFAULT NULL,
+ "start_epoch_microsec" varchar(100) DEFAULT NULL,
+ "last_epoch_microsec" varchar(100) DEFAULT NULL,
+ CONSTRAINT alarms_additionalinformation_pk PRIMARY KEY (id)
+) WITH ( OIDS = FALSE);
+
+-- ----------------------------
+-- Table structure for "alarms_commoneventheader"
+-- ----------------------------
+DROP TABLE alarms_commoneventheader;
+CREATE TABLE alarms_commoneventheader (
+ "id" varchar(50) NOT NULL,
+ "version" varchar(100) DEFAULT NULL,
+ "event_name" varchar(100) DEFAULT NULL,
+ "domain" varchar(100) DEFAULT NULL,
+ "event_id" varchar(100) DEFAULT NULL,
+ "event_type" varchar(100) DEFAULT NULL,
+ "nfc_naming_code" varchar(100) DEFAULT NULL,
+ "nf_naming_code" varchar(100) DEFAULT NULL,
+ "source_id" varchar(100) DEFAULT NULL,
+ "source_name" varchar(100) DEFAULT NULL,
+ "reporting_entity_id" varchar(100) DEFAULT NULL,
+ "reporting_entity_name" varchar(100) DEFAULT NULL,
+ "priority" varchar(50) DEFAULT NULL,
+ "start_epoch_microsec" varchar(100) DEFAULT NULL,
+ "last_epoch_microsec" varchar(100) DEFAULT NULL,
+ "start_epoch_microsec_cleared" varchar(100) DEFAULT NULL,
+ "last_epoch_microsec_cleared" varchar(100) DEFAULT NULL,
+ "sequence" varchar(100) DEFAULT NULL,
+ "fault_fields_version" varchar(100) DEFAULT NULL,
+ "event_servrity" varchar(100) DEFAULT NULL,
+ "event_source_type" varchar(100) DEFAULT NULL,
+ "event_category" varchar(100) DEFAULT NULL,
+ "alarm_condition" varchar(100) DEFAULT NULL,
+ "specific_problem" varchar(100) DEFAULT NULL,
+ "vf_status" varchar(100) DEFAULT NULL,
+ "alarm_interfacea" varchar(100) DEFAULT NULL,
+ "status" varchar(50) DEFAULT NULL,
+ CONSTRAINT alarms_commoneventheader_pk PRIMARY KEY (id)
+) WITH ( OIDS = FALSE );
+
+-- ----------------------------
+-- Table structure for "performance_additionalinformation"
+-- ----------------------------
+DROP TABLE performance_additionalinformation;
+CREATE TABLE performance_additionalinformation (
+ id serial,
+ "header_id" varchar(50) NOT NULL,
+ "name" varchar(100) DEFAULT NULL,
+ "value" varchar(100) DEFAULT NULL,
+ "source_id" varchar(100) DEFAULT NULL,
+ "start_epoch_microsec" varchar(100) DEFAULT NULL,
+ "last_epoch_microsec" varchar(100) DEFAULT NULL,
+ CONSTRAINT performance_additionalinformation_pk PRIMARY KEY (id)
+) WITH ( OIDS = FALSE );
+
+-- ----------------------------
+-- Table structure for "performance_commoneventheader"
+-- ----------------------------
+DROP TABLE performance_commoneventheader;
+CREATE TABLE performance_commoneventheader (
+ "id" varchar(50) NOT NULL,
+ "version" varchar(100) DEFAULT NULL,
+ "event_name" varchar(100) DEFAULT NULL,
+ "domain" varchar(100) DEFAULT NULL,
+ "event_id" varchar(100) DEFAULT NULL,
+ "event_type" varchar(100) DEFAULT NULL,
+ "nfc_naming_code" varchar(100) DEFAULT NULL,
+ "nf_namingcode" varchar(100) DEFAULT NULL,
+ "source_id" varchar(100) DEFAULT NULL,
+ "source_name" varchar(100) DEFAULT NULL,
+ "reporting_entity_id" varchar(100) DEFAULT NULL,
+ "reporting_entity_name" varchar(100) DEFAULT NULL,
+ "priority" varchar(50) DEFAULT NULL,
+ "start_epoch_microsec" varchar(100) DEFAULT NULL,
+ "last_epoch_microsec" varchar(100) DEFAULT NULL,
+ "sequence" varchar(100) DEFAULT NULL,
+ "measurements_for_vf_scaling_version" varchar(100) DEFAULT NULL,
+ "measurement_interval" varchar(100) DEFAULT NULL,
+ CONSTRAINT performance_commoneventheader_pk PRIMARY KEY (id)
+) WITH (OIDS = FALSE);
+
+-- ----------------------------
+-- Table structure for service_instances
+-- ----------------------------
+DROP TABLE service_instances;
+CREATE TABLE service_instances (
+ "id" varchar(50) NOT NULL,
+ "service_instance_id" varchar(100) NOT NULL,
+ "customer_id" varchar(50) NOT NULL,
+ "service_type" varchar(50) NOT NULL,
+ "usecase_type" varchar(50) NOT NULL,
+ "parent_service_instance_id" varchar(100) DEFAULT NULL,
+ "uuid" varchar(100),
+ "invariant_uuid" varchar(100),
+ CONSTRAINT service_instances_pk PRIMARY KEY (service_instance_id)
+);
+
+-- ----------------------------
+-- Table structure for service_instance_operations
+-- ----------------------------
+DROP TABLE service_instance_operations;
+CREATE TABLE service_instance_operations (
+ "service_instance_id" varchar(100) NOT NULL,
+ "operation_id" varchar(100) NOT NULL,
+ "operation_type" varchar(50) NOT NULL,
+ "operation_progress" varchar(50) NOT NULL,
+ "operation_result" varchar(100) DEFAULT NULL,
+ "start_time" varchar(100) NOT NULL,
+ "end_time" varchar(100),
+ CONSTRAINT service_instance_operations_pk PRIMARY KEY (service_instance_id, operation_id)
+);
+
+-- ----------------------------
+-- Table structure for sort_master
+-- ----------------------------
+DROP TABLE sort_master;
+CREATE TABLE sort_master (
+ "sort_type" varchar(50) NOT NULL,
+ "sort_code" varchar(10) NOT NULL,
+ "sort_value" varchar(100) NOT NULL,
+ "language" varchar(50) NOT NULL,
+ CONSTRAINT sort_master_pk PRIMARY KEY (sort_type, sort_code, language)
+);