summaryrefslogtreecommitdiffstats
path: root/extra/sql/bulkload/create-tables.sql
blob: 6e9ff7c867503a2401fce99b096f0d45b87e9a09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    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,
        svg_representation MEDIUMTEXT,
        service_uuid varchar(255),
        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,
        json_representation json not null,
        loop_id varchar(255) not null,
        primary key (name)
    ) engine=InnoDB;

    create table services (
       service_uuid varchar(255) not null,
        name varchar(255) not null,
        resource_details json,
        service_details json,
        version varchar(255),
        primary key (service_uuid)
    ) engine=InnoDB;

    alter table loop_logs 
       add constraint FK1j0cda46aickcaoxqoo34khg2 
       foreign key (loop_id) 
       references loops (name);

    alter table loops 
       add constraint FK4b9wnqopxogwek014i1shqw7w 
       foreign key (service_uuid) 
       references services (service_uuid);

    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);