Merge "Create Service object"
[clamp.git] / extra / sql / bulkload / create-tables.sql
1
2     create table hibernate_sequence (
3        next_val bigint
4     ) engine=InnoDB;
5
6     insert into hibernate_sequence values ( 1 );
7
8     create table loop_logs (
9        id bigint not null,
10         log_component varchar(255) not null,
11         log_instant datetime(6) not null,
12         log_type varchar(255) not null,
13         message MEDIUMTEXT not null,
14         loop_id varchar(255) not null,
15         primary key (id)
16     ) engine=InnoDB;
17
18     create table loops (
19        name varchar(255) not null,
20         blueprint_yaml MEDIUMTEXT not null,
21         dcae_blueprint_id varchar(255),
22         dcae_deployment_id varchar(255),
23         dcae_deployment_status_url varchar(255),
24         global_properties_json json,
25         last_computed_state varchar(255) not null,
26         operational_policy_schema json,
27         svg_representation MEDIUMTEXT,
28         service_uuid varchar(255),
29         primary key (name)
30     ) engine=InnoDB;
31
32     create table loops_microservicepolicies (
33        loop_id varchar(255) not null,
34         microservicepolicy_id varchar(255) not null,
35         primary key (loop_id, microservicepolicy_id)
36     ) engine=InnoDB;
37
38     create table micro_service_policies (
39        name varchar(255) not null,
40         json_representation json not null,
41         model_type varchar(255) not null,
42         policy_tosca MEDIUMTEXT not null,
43         properties json,
44         shared bit not null,
45         primary key (name)
46     ) engine=InnoDB;
47
48     create table operational_policies (
49        name varchar(255) not null,
50         configurations_json json,
51         loop_id varchar(255) not null,
52         primary key (name)
53     ) engine=InnoDB;
54
55     create table services (
56        service_uuid varchar(255) not null,
57         name varchar(255) not null,
58         resource_details json,
59         service_details json,
60         primary key (service_uuid)
61     ) engine=InnoDB;
62
63     alter table loop_logs 
64        add constraint FK1j0cda46aickcaoxqoo34khg2 
65        foreign key (loop_id) 
66        references loops (name);
67
68     alter table loops 
69        add constraint FK4b9wnqopxogwek014i1shqw7w 
70        foreign key (service_uuid) 
71        references services (service_uuid);
72
73     alter table loops_microservicepolicies 
74        add constraint FKem7tp1cdlpwe28av7ef91j1yl 
75        foreign key (microservicepolicy_id) 
76        references micro_service_policies (name);
77
78     alter table loops_microservicepolicies 
79        add constraint FKsvx91jekgdkfh34iaxtjfgebt 
80        foreign key (loop_id) 
81        references loops (name);
82
83     alter table operational_policies 
84        add constraint FK1ddoggk9ni2bnqighv6ecmuwu 
85        foreign key (loop_id) 
86        references loops (name);