blob: 3312daf56f684f11da31a33d1fa7f0da601a48f5 [file] [log] [blame]
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -07001#
ChrisC5e9feb22017-06-21 02:38:57 -07002# Create CLDS database objects (tables, etc.)
3#
4#
5CREATE DATABASE `camundabpm`;
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -07006USE `camundabpm`;
7DROP USER 'camunda';
8CREATE USER 'camunda';
9GRANT ALL on camundabpm.* to 'camunda' identified by 'ndMSpw4CAM' with GRANT OPTION;
10FLUSH PRIVILEGES;
ChrisC5e9feb22017-06-21 02:38:57 -070011
12CREATE DATABASE `cldsdb4`;
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070013USE `cldsdb4`;
14DROP USER 'clds';
15CREATE USER 'clds';
ChrisC5e9feb22017-06-21 02:38:57 -070016GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION;
17GRANT SELECT on mysql.proc TO 'clds';
18FLUSH PRIVILEGES;
19
20
21CREATE TABLE template (
22 template_id VARCHAR(36) NOT NULL,
23 template_name VARCHAR(80) NOT NULL,
24 template_bpmn_id VARCHAR(36) NULL,
25 template_image_id VARCHAR(36) NULL,
26 template_doc_id VARCHAR(36) NULL,
27 PRIMARY KEY (template_id),
28 UNIQUE (template_name)
29) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
30
31CREATE TABLE template_bpmn (
32 template_bpmn_id VARCHAR(36) NOT NULL,
33 template_id VARCHAR(36) NOT NULL,
34 template_bpmn_text MEDIUMTEXT NOT NULL,
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070035 user_id VARCHAR(80),
ChrisC5e9feb22017-06-21 02:38:57 -070036 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
37 PRIMARY KEY (template_bpmn_id)
38) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
39
40CREATE TABLE template_image (
41 template_image_id VARCHAR(36) NOT NULL,
42 template_id VARCHAR(36) NOT NULL,
43 template_image_text MEDIUMTEXT NULL,
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070044 user_id VARCHAR(80),
ChrisC5e9feb22017-06-21 02:38:57 -070045 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
46 PRIMARY KEY (template_image_id)
47) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
48
49CREATE TABLE template_doc (
50 template_doc_id VARCHAR(36) NOT NULL,
51 template_id VARCHAR(36) NOT NULL,
52 template_doc_text MEDIUMTEXT NULL,
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070053 user_id VARCHAR(80),
ChrisC5e9feb22017-06-21 02:38:57 -070054 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
55 PRIMARY KEY (template_doc_id)
56) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
57
58CREATE TABLE model (
59 model_id VARCHAR(36) NOT NULL,
60 model_name VARCHAR(80) NOT NULL,
61 template_id VARCHAR(36) NULL,
62 model_prop_id VARCHAR(36) NULL,
63 model_blueprint_id VARCHAR(36) NULL,
64 event_id VARCHAR(36) NULL,
65 control_name_prefix VARCHAR(80) NULL,
66 control_name_uuid VARCHAR(36) NOT NULL,
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070067 service_type_id VARCHAR(80) NULL,
68 deployment_id VARCHAR(80) NULL,
ChrisC5e9feb22017-06-21 02:38:57 -070069 PRIMARY KEY (model_id),
70 UNIQUE (model_name),
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070071 UNIQUE (control_name_uuid),
72 UNIQUE (service_type_id),
73 UNIQUE (deployment_id)
ChrisC5e9feb22017-06-21 02:38:57 -070074) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
75
76CREATE TABLE model_properties (
77 model_prop_id VARCHAR(36) NOT NULL,
78 model_id VARCHAR(36) NOT NULL,
79 model_prop_text MEDIUMTEXT NULL,
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070080 user_id VARCHAR(80),
ChrisC5e9feb22017-06-21 02:38:57 -070081 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
82 PRIMARY KEY (model_prop_id)
83) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
84
85CREATE TABLE model_blueprint (
86 model_blueprint_id VARCHAR(36) NOT NULL,
87 model_id VARCHAR(36) NOT NULL,
88 model_blueprint_text MEDIUMTEXT NULL,
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -070089 user_id VARCHAR(80),
ChrisC5e9feb22017-06-21 02:38:57 -070090 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
91 PRIMARY KEY (model_blueprint_id)
92) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
93
94CREATE TABLE model_instance (
95 model_instance_id VARCHAR(36) NOT NULL,
96 model_id VARCHAR(36) NOT NULL,
97 vm_name VARCHAR(250) NOT NULL,
98 location VARCHAR(250) NULL,
99 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
100 PRIMARY KEY (model_instance_id),
101 UNIQUE (model_id, vm_name)
102) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
103
104CREATE TABLE event (
105 event_id VARCHAR(36) NOT NULL,
106 model_id VARCHAR(36) NULL,
107 action_cd VARCHAR(80) NOT NULL,
108 action_state_cd VARCHAR(80) NULL,
109 prev_event_id VARCHAR(36) NULL,
110 process_instance_id VARCHAR(80) NULL,
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700111 user_id VARCHAR(80) NULL,
ChrisC5e9feb22017-06-21 02:38:57 -0700112 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
113 PRIMARY KEY (event_id)
114) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
115
116CREATE TABLE clds_service_cache (
117 invariant_service_id VARCHAR(36) NOT NULL,
118 service_id VARCHAR(36) NULL,
119 timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
120 object_data MEDIUMBLOB NULL,
121 PRIMARY KEY (invariant_service_id)
122) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
123
124ALTER TABLE template
125 ADD CONSTRAINT template_bpmn_id_fkey01
126 FOREIGN KEY (template_bpmn_id)
127 REFERENCES template_bpmn (template_bpmn_id);
128
129ALTER TABLE template
130 ADD CONSTRAINT template_image_id_fkey01
131 FOREIGN KEY (template_image_id)
132 REFERENCES template_image (template_image_id);
133
134ALTER TABLE template
135 ADD CONSTRAINT template_doc_id_fkey01
136 FOREIGN KEY (template_doc_id)
137 REFERENCES template_doc (template_doc_id);
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700138
ChrisC5e9feb22017-06-21 02:38:57 -0700139ALTER TABLE template_bpmn
140 ADD CONSTRAINT template_id_fkey02
141 FOREIGN KEY (template_id)
142 REFERENCES template (template_id);
143
144ALTER TABLE template_image
145 ADD CONSTRAINT template_id_fkey03
146 FOREIGN KEY (template_id)
147 REFERENCES template (template_id);
148
149ALTER TABLE template_doc
150 ADD CONSTRAINT template_id_fkey04
151 FOREIGN KEY (template_id)
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700152 REFERENCES template (template_id);
153
ChrisC5e9feb22017-06-21 02:38:57 -0700154ALTER TABLE model
155 ADD CONSTRAINT template_id_fkey01
156 FOREIGN KEY (template_id)
157 REFERENCES template (template_id);
158
159ALTER TABLE model
160 ADD CONSTRAINT model_prop_id_fkey01
161 FOREIGN KEY (model_prop_id)
162 REFERENCES model_properties (model_prop_id);
163
164ALTER TABLE model
165 ADD CONSTRAINT model_blueprint_id_fkey01
166 FOREIGN KEY (model_blueprint_id)
167 REFERENCES model_blueprint (model_blueprint_id);
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700168
ChrisC5e9feb22017-06-21 02:38:57 -0700169ALTER TABLE model
170 ADD CONSTRAINT event_id_fkey01
171 FOREIGN KEY (event_id)
172 REFERENCES event (event_id);
173
174ALTER TABLE model_properties
175 ADD CONSTRAINT model_id_fkey01
176 FOREIGN KEY (model_id)
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700177 REFERENCES model (model_id);
ChrisC5e9feb22017-06-21 02:38:57 -0700178
179ALTER TABLE model_blueprint
180 ADD CONSTRAINT model_id_fkey02
181 FOREIGN KEY (model_id)
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700182 REFERENCES model (model_id);
ChrisC5e9feb22017-06-21 02:38:57 -0700183
184ALTER TABLE model_instance
185 ADD CONSTRAINT model_id_fkey04
186 FOREIGN KEY (model_id)
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700187 REFERENCES model (model_id);
188
ChrisC5e9feb22017-06-21 02:38:57 -0700189ALTER TABLE event
190 ADD CONSTRAINT model_id_fkey03
191 FOREIGN KEY (model_id)
Determe, Sebastien (sd378r)b3a21f72017-08-08 02:58:27 -0700192 REFERENCES model (model_id);