Update CLAMP mariadb version to 10.3.12
[oom.git] / kubernetes / clamp / charts / mariadb / resources / config / mariadb / docker-entrypoint-initdb.d / bulkload / create-tables.sql
1 /* Copyright © 2019 AT&T
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *       http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15     create table hibernate_sequence (
16        next_val bigint
17     ) engine=InnoDB;
18
19     insert into hibernate_sequence values ( 1 );
20
21     create table loop_logs (
22        id bigint not null,
23         log_instant datetime(6) not null,
24         log_type varchar(255) not null,
25         message varchar(255) not null,
26         loop_id varchar(255) not null,
27         primary key (id)
28     ) engine=InnoDB;
29
30     create table loops (
31        name varchar(255) not null,
32         blueprint_yaml MEDIUMTEXT not null,
33         dcae_blueprint_id varchar(255),
34         dcae_deployment_id varchar(255),
35         dcae_deployment_status_url varchar(255),
36         global_properties_json json,
37         last_computed_state varchar(255) not null,
38         model_properties_json json,
39         svg_representation MEDIUMTEXT,
40         primary key (name)
41     ) engine=InnoDB;
42
43     create table loops_microservicepolicies (
44        loop_id varchar(255) not null,
45         microservicepolicy_id varchar(255) not null,
46         primary key (loop_id, microservicepolicy_id)
47     ) engine=InnoDB;
48
49     create table micro_service_policies (
50        name varchar(255) not null,
51         json_representation json not null,
52         model_type varchar(255) not null,
53         policy_tosca MEDIUMTEXT not null,
54         properties json,
55         shared bit not null,
56         primary key (name)
57     ) engine=InnoDB;
58
59     create table operational_policies (
60        name varchar(255) not null,
61         configurations_json json,
62         loop_id varchar(255) not null,
63         primary key (name)
64     ) engine=InnoDB;
65
66     alter table loop_logs
67        add constraint FK1j0cda46aickcaoxqoo34khg2
68        foreign key (loop_id)
69        references loops (name);
70
71     alter table loops_microservicepolicies
72        add constraint FKem7tp1cdlpwe28av7ef91j1yl
73        foreign key (microservicepolicy_id)
74        references micro_service_policies (name);
75
76     alter table loops_microservicepolicies
77        add constraint FKsvx91jekgdkfh34iaxtjfgebt
78        foreign key (loop_id)
79        references loops (name);
80
81     alter table operational_policies
82        add constraint FK1ddoggk9ni2bnqighv6ecmuwu
83        foreign key (loop_id)
84        references loops (name);