diff options
Diffstat (limited to 'charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d')
3 files changed, 112 insertions, 0 deletions
diff --git a/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bootstrap-database.sh b/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bootstrap-database.sh new file mode 100755 index 0000000..224a813 --- /dev/null +++ b/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bootstrap-database.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +### +# ============LICENSE_START======================================================= +# ONAP CLAMP +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. 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. +# ============LICENSE_END============================================ +# =================================================================== +# +### + +mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < /docker-entrypoint-initdb.d/bulkload/create-db.sql +## New model creation +mysql -uroot -p$MYSQL_ROOT_PASSWORD -f cldsdb4 < /docker-entrypoint-initdb.d/bulkload/create-tables.sql diff --git a/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-db.sql b/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-db.sql new file mode 100644 index 0000000..ea4d97c --- /dev/null +++ b/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-db.sql @@ -0,0 +1,11 @@ +# +# Create CLDS database objects (tables, etc.) +# +# +CREATE DATABASE `cldsdb4`; +USE `cldsdb4`; +DROP USER 'clds'; +CREATE USER 'clds'; +GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION; +FLUSH PRIVILEGES; + diff --git a/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-tables.sql b/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-tables.sql new file mode 100644 index 0000000..0e15d4d --- /dev/null +++ b/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-tables.sql @@ -0,0 +1,73 @@ + + create table hibernate_sequence ( + next_val bigint + ) engine=InnoDB; + + insert into hibernate_sequence values ( 1 ); + + create table loop_logs ( + id bigint not null, + log_component varchar(255) not null, + log_instant datetime(6) not null, + log_type varchar(255) not null, + message MEDIUMTEXT not null, + loop_id varchar(255) not null, + primary key (id) + ) engine=InnoDB; + + create table loops ( + name varchar(255) not null, + blueprint_yaml MEDIUMTEXT not null, + dcae_blueprint_id varchar(255), + dcae_deployment_id varchar(255), + dcae_deployment_status_url varchar(255), + global_properties_json json, + last_computed_state varchar(255) not null, + model_properties_json json, + operational_policy_schema json, + svg_representation MEDIUMTEXT, + primary key (name) + ) engine=InnoDB; + + create table loops_microservicepolicies ( + loop_id varchar(255) not null, + microservicepolicy_id varchar(255) not null, + primary key (loop_id, microservicepolicy_id) + ) engine=InnoDB; + + create table micro_service_policies ( + name varchar(255) not null, + json_representation json not null, + model_type varchar(255) not null, + policy_tosca MEDIUMTEXT not null, + properties json, + shared bit not null, + primary key (name) + ) engine=InnoDB; + + create table operational_policies ( + name varchar(255) not null, + configurations_json json, + loop_id varchar(255) not null, + primary key (name) + ) engine=InnoDB; + + alter table loop_logs + add constraint FK1j0cda46aickcaoxqoo34khg2 + foreign key (loop_id) + references loops (name); + + alter table loops_microservicepolicies + add constraint FKem7tp1cdlpwe28av7ef91j1yl + foreign key (microservicepolicy_id) + references micro_service_policies (name); + + alter table loops_microservicepolicies + add constraint FKsvx91jekgdkfh34iaxtjfgebt + foreign key (loop_id) + references loops (name); + + alter table operational_policies + add constraint FK1ddoggk9ni2bnqighv6ecmuwu + foreign key (loop_id) + references loops (name); |