3 |
rodolico |
1 |
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
|
|
2 |
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
|
|
3 |
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
|
|
|
4 |
|
|
|
5 |
CREATE SCHEMA IF NOT EXISTS `camp2` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
|
|
|
6 |
USE `camp2` ;
|
|
|
7 |
|
|
|
8 |
-- -----------------------------------------------------
|
|
|
9 |
-- Table `camp2`.`_user`
|
|
|
10 |
-- -----------------------------------------------------
|
|
|
11 |
DROP TABLE IF EXISTS `camp2`.`_user` ;
|
|
|
12 |
|
|
|
13 |
CREATE TABLE IF NOT EXISTS `camp2`.`_user` (
|
|
|
14 |
`_user_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
15 |
`name` VARCHAR(64) NOT NULL COMMENT 'user login name' ,
|
|
|
16 |
`passwd` CHAR(32) NOT NULL COMMENT 'md5 hash of users password' ,
|
|
|
17 |
`email` VARCHAR(64) NULL COMMENT 'email address of user' ,
|
|
|
18 |
`added_date` DATETIME NULL COMMENT 'date user was added' ,
|
|
|
19 |
`removed_date` DATETIME NULL DEFAULT NULL COMMENT 'date user removed' ,
|
|
|
20 |
PRIMARY KEY (`_user_id`) )
|
|
|
21 |
ENGINE = InnoDB;
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
-- -----------------------------------------------------
|
|
|
25 |
-- Table `camp2`.`client`
|
|
|
26 |
-- -----------------------------------------------------
|
|
|
27 |
DROP TABLE IF EXISTS `camp2`.`client` ;
|
|
|
28 |
|
|
|
29 |
CREATE TABLE IF NOT EXISTS `camp2`.`client` (
|
|
|
30 |
`client_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
31 |
`name` VARCHAR(64) NULL DEFAULT NULL COMMENT 'display name of client' ,
|
|
|
32 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
33 |
`added_date` DATETIME NOT NULL ,
|
|
|
34 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
35 |
PRIMARY KEY (`client_id`) ,
|
|
|
36 |
INDEX `fk_client_1` (`_user_id` ASC) ,
|
|
|
37 |
CONSTRAINT `fk_client_1`
|
|
|
38 |
FOREIGN KEY (`_user_id` )
|
|
|
39 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
40 |
ON DELETE NO ACTION
|
|
|
41 |
ON UPDATE NO ACTION)
|
|
|
42 |
ENGINE = InnoDB
|
|
|
43 |
COMMENT = 'stores client name. other client info stored in client_attri' /* comment truncated */;
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
-- -----------------------------------------------------
|
|
|
47 |
-- Table `camp2`.`location`
|
|
|
48 |
-- -----------------------------------------------------
|
|
|
49 |
DROP TABLE IF EXISTS `camp2`.`location` ;
|
|
|
50 |
|
|
|
51 |
CREATE TABLE IF NOT EXISTS `camp2`.`location` (
|
|
|
52 |
`location_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
53 |
`name` VARCHAR(64) NULL DEFAULT NULL COMMENT 'display name of location' ,
|
|
|
54 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
55 |
`added_date` DATETIME NOT NULL ,
|
|
|
56 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
57 |
PRIMARY KEY (`location_id`) ,
|
|
|
58 |
INDEX `fk_location_1` (`_user_id` ASC) ,
|
|
|
59 |
CONSTRAINT `fk_location_1`
|
|
|
60 |
FOREIGN KEY (`_user_id` )
|
|
|
61 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
62 |
ON DELETE NO ACTION
|
|
|
63 |
ON UPDATE NO ACTION)
|
|
|
64 |
ENGINE = InnoDB
|
|
|
65 |
COMMENT = 'stores location name. other location info stored in location' /* comment truncated */;
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
-- -----------------------------------------------------
|
|
|
69 |
-- Table `camp2`.`device_type`
|
|
|
70 |
-- -----------------------------------------------------
|
|
|
71 |
DROP TABLE IF EXISTS `camp2`.`device_type` ;
|
|
|
72 |
|
|
|
73 |
CREATE TABLE IF NOT EXISTS `camp2`.`device_type` (
|
|
|
74 |
`device_type_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
75 |
`name` VARCHAR(64) NULL DEFAULT NULL COMMENT 'display name of device type' ,
|
|
|
76 |
`show_as_system` TINYINT(1) NULL DEFAULT NULL COMMENT 'whether to display as a system or not' ,
|
|
|
77 |
PRIMARY KEY (`device_type_id`) )
|
|
|
78 |
ENGINE = InnoDB
|
|
|
79 |
COMMENT = 'types of devices (computer, printer ...)';
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
-- -----------------------------------------------------
|
|
|
83 |
-- Table `camp2`.`device`
|
|
|
84 |
-- -----------------------------------------------------
|
|
|
85 |
DROP TABLE IF EXISTS `camp2`.`device` ;
|
|
|
86 |
|
|
|
87 |
CREATE TABLE IF NOT EXISTS `camp2`.`device` (
|
|
|
88 |
`device_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
89 |
`name` VARCHAR(64) NULL DEFAULT NULL COMMENT 'display name of device' ,
|
|
|
90 |
`device_type_id` INT UNSIGNED NOT NULL ,
|
|
|
91 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
92 |
`added_date` DATETIME NOT NULL ,
|
|
|
93 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
94 |
PRIMARY KEY (`device_id`) ,
|
|
|
95 |
INDEX `fk_ecf202fe-d2bf-11e5-94fa-e0cb4ed780b9` (`device_type_id` ASC) ,
|
|
|
96 |
INDEX `fk_device_1` (`_user_id` ASC) ,
|
|
|
97 |
CONSTRAINT `fk_ecf202fe-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
98 |
FOREIGN KEY (`device_type_id` )
|
|
|
99 |
REFERENCES `camp2`.`device_type` (`device_type_id` )
|
|
|
100 |
ON DELETE RESTRICT
|
|
|
101 |
ON UPDATE RESTRICT,
|
|
|
102 |
CONSTRAINT `fk_device_1`
|
|
|
103 |
FOREIGN KEY (`_user_id` )
|
|
|
104 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
105 |
ON DELETE NO ACTION
|
|
|
106 |
ON UPDATE NO ACTION)
|
|
|
107 |
ENGINE = InnoDB
|
|
|
108 |
COMMENT = 'stores device name and type. other device info stored in dev' /* comment truncated */;
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
-- -----------------------------------------------------
|
|
|
112 |
-- Table `camp2`.`device_location`
|
|
|
113 |
-- -----------------------------------------------------
|
|
|
114 |
DROP TABLE IF EXISTS `camp2`.`device_location` ;
|
|
|
115 |
|
|
|
116 |
CREATE TABLE IF NOT EXISTS `camp2`.`device_location` (
|
|
|
117 |
`device_location_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
118 |
`device_id` INT UNSIGNED NOT NULL ,
|
|
|
119 |
`location_id` INT UNSIGNED NOT NULL ,
|
|
|
120 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
121 |
`added_date` DATETIME NOT NULL ,
|
|
|
122 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
123 |
PRIMARY KEY (`device_location_id`) ,
|
|
|
124 |
INDEX (`device_id` ASC, `location_id` ASC, `added_date` ASC, `removed_date` ASC) ,
|
|
|
125 |
INDEX `fk_ecf2308a-d2bf-11e5-94fa-e0cb4ed780b9` (`location_id` ASC) ,
|
|
|
126 |
INDEX `fk_device_location_1` (`_user_id` ASC) ,
|
|
|
127 |
CONSTRAINT `fk_ecf22df6-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
128 |
FOREIGN KEY (`device_id` )
|
|
|
129 |
REFERENCES `camp2`.`device` (`device_id` )
|
|
|
130 |
ON DELETE RESTRICT
|
|
|
131 |
ON UPDATE RESTRICT,
|
|
|
132 |
CONSTRAINT `fk_ecf2308a-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
133 |
FOREIGN KEY (`location_id` )
|
|
|
134 |
REFERENCES `camp2`.`location` (`location_id` )
|
|
|
135 |
ON DELETE RESTRICT
|
|
|
136 |
ON UPDATE RESTRICT,
|
|
|
137 |
CONSTRAINT `fk_device_location_1`
|
|
|
138 |
FOREIGN KEY (`_user_id` )
|
|
|
139 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
140 |
ON DELETE NO ACTION
|
|
|
141 |
ON UPDATE NO ACTION)
|
|
|
142 |
ENGINE = InnoDB
|
|
|
143 |
COMMENT = 'links location and device tables';
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
-- -----------------------------------------------------
|
|
|
147 |
-- Table `camp2`.`device_client`
|
|
|
148 |
-- -----------------------------------------------------
|
|
|
149 |
DROP TABLE IF EXISTS `camp2`.`device_client` ;
|
|
|
150 |
|
|
|
151 |
CREATE TABLE IF NOT EXISTS `camp2`.`device_client` (
|
|
|
152 |
`device_client_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
153 |
`device_id` INT UNSIGNED NOT NULL ,
|
|
|
154 |
`client_id` INT UNSIGNED NOT NULL ,
|
|
|
155 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
156 |
`added_date` DATETIME NOT NULL ,
|
|
|
157 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
158 |
PRIMARY KEY (`device_client_id`) ,
|
|
|
159 |
INDEX `fk_device_client_device` (`device_id` ASC) ,
|
|
|
160 |
INDEX `fk_device_client_client` (`client_id` ASC) ,
|
|
|
161 |
INDEX `fk_device_client_user` (`_user_id` ASC) ,
|
|
|
162 |
CONSTRAINT `fk_device_client_device`
|
|
|
163 |
FOREIGN KEY (`device_id` )
|
|
|
164 |
REFERENCES `camp2`.`device` (`device_id` )
|
|
|
165 |
ON DELETE RESTRICT
|
|
|
166 |
ON UPDATE RESTRICT,
|
|
|
167 |
CONSTRAINT `fk_device_client_client`
|
|
|
168 |
FOREIGN KEY (`client_id` )
|
|
|
169 |
REFERENCES `camp2`.`client` (`client_id` )
|
|
|
170 |
ON DELETE RESTRICT
|
|
|
171 |
ON UPDATE RESTRICT,
|
|
|
172 |
CONSTRAINT `fk_device_client_user`
|
|
|
173 |
FOREIGN KEY (`_user_id` )
|
|
|
174 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
175 |
ON DELETE NO ACTION
|
|
|
176 |
ON UPDATE NO ACTION)
|
|
|
177 |
ENGINE = InnoDB
|
|
|
178 |
COMMENT = 'links device and client tables';
|
|
|
179 |
|
|
|
180 |
|
|
|
181 |
-- -----------------------------------------------------
|
|
|
182 |
-- Table `camp2`.`location_client`
|
|
|
183 |
-- -----------------------------------------------------
|
|
|
184 |
DROP TABLE IF EXISTS `camp2`.`location_client` ;
|
|
|
185 |
|
|
|
186 |
CREATE TABLE IF NOT EXISTS `camp2`.`location_client` (
|
|
|
187 |
`location_client_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
188 |
`location_id` INT UNSIGNED NOT NULL ,
|
|
|
189 |
`client_id` INT UNSIGNED NOT NULL ,
|
|
|
190 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
191 |
`added_date` DATETIME NOT NULL ,
|
|
|
192 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
193 |
PRIMARY KEY (`location_client_id`) ,
|
|
|
194 |
INDEX (`location_id` ASC, `client_id` ASC) ,
|
|
|
195 |
INDEX `fk_ecf26550-d2bf-11e5-94fa-e0cb4ed780b9` (`client_id` ASC) ,
|
|
|
196 |
INDEX `fk_location_client_1` (`_user_id` ASC) ,
|
|
|
197 |
CONSTRAINT `fk_ecf262d0-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
198 |
FOREIGN KEY (`location_id` )
|
|
|
199 |
REFERENCES `camp2`.`location` (`location_id` )
|
|
|
200 |
ON DELETE RESTRICT
|
|
|
201 |
ON UPDATE RESTRICT,
|
|
|
202 |
CONSTRAINT `fk_ecf26550-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
203 |
FOREIGN KEY (`client_id` )
|
|
|
204 |
REFERENCES `camp2`.`client` (`client_id` ),
|
|
|
205 |
CONSTRAINT `fk_location_client_1`
|
|
|
206 |
FOREIGN KEY (`_user_id` )
|
|
|
207 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
208 |
ON DELETE NO ACTION
|
|
|
209 |
ON UPDATE NO ACTION)
|
|
|
210 |
ENGINE = InnoDB
|
|
|
211 |
COMMENT = 'links location and client tables';
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
-- -----------------------------------------------------
|
|
|
215 |
-- Table `camp2`.`category`
|
|
|
216 |
-- -----------------------------------------------------
|
|
|
217 |
DROP TABLE IF EXISTS `camp2`.`category` ;
|
|
|
218 |
|
|
|
219 |
CREATE TABLE IF NOT EXISTS `camp2`.`category` (
|
|
|
220 |
`category_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
221 |
`name` VARCHAR(64) NULL DEFAULT NULL ,
|
|
|
222 |
PRIMARY KEY (`category_id`) )
|
|
|
223 |
ENGINE = InnoDB
|
|
|
224 |
COMMENT = 'categories for attribute table';
|
|
|
225 |
|
|
|
226 |
|
|
|
227 |
-- -----------------------------------------------------
|
|
|
228 |
-- Table `camp2`.`attribute`
|
|
|
229 |
-- -----------------------------------------------------
|
|
|
230 |
DROP TABLE IF EXISTS `camp2`.`attribute` ;
|
|
|
231 |
|
|
|
232 |
CREATE TABLE IF NOT EXISTS `camp2`.`attribute` (
|
|
|
233 |
`attribute_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
234 |
`name` VARCHAR(64) NOT NULL COMMENT 'name for display' ,
|
|
|
235 |
`report_name` VARCHAR(64) NULL DEFAULT NULL COMMENT 'name in sysinfo reports' ,
|
|
|
236 |
`category_id` INT UNSIGNED NOT NULL ,
|
|
|
237 |
PRIMARY KEY (`attribute_id`) ,
|
|
|
238 |
INDEX `fk_ecf28e4a-d2bf-11e5-94fa-e0cb4ed780b9` (`category_id` ASC) ,
|
|
|
239 |
CONSTRAINT `fk_ecf28e4a-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
240 |
FOREIGN KEY (`category_id` )
|
|
|
241 |
REFERENCES `camp2`.`category` (`category_id` ))
|
|
|
242 |
ENGINE = InnoDB
|
|
|
243 |
COMMENT = 'stores attribute names (not values) for other tables';
|
|
|
244 |
|
|
|
245 |
|
|
|
246 |
-- -----------------------------------------------------
|
|
|
247 |
-- Table `camp2`.`device_attribute`
|
|
|
248 |
-- -----------------------------------------------------
|
|
|
249 |
DROP TABLE IF EXISTS `camp2`.`device_attribute` ;
|
|
|
250 |
|
|
|
251 |
CREATE TABLE IF NOT EXISTS `camp2`.`device_attribute` (
|
|
|
252 |
`device_attribute_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
253 |
`device_id` INT UNSIGNED NOT NULL ,
|
|
|
254 |
`attribute_id` INT UNSIGNED NOT NULL ,
|
|
|
255 |
`report_value` TEXT NULL DEFAULT NULL ,
|
|
|
256 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
257 |
`added_date` DATETIME NOT NULL ,
|
|
|
258 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
259 |
PRIMARY KEY (`device_attribute_id`) ,
|
|
|
260 |
INDEX (`device_id` ASC, `attribute_id` ASC, `added_date` ASC, `removed_date` ASC) ,
|
|
|
261 |
INDEX `fk_ecf2a47a-d2bf-11e5-94fa-e0cb4ed780b9` (`attribute_id` ASC) ,
|
|
|
262 |
INDEX `fk_device_attribute_1` (`_user_id` ASC) ,
|
|
|
263 |
CONSTRAINT `fk_ecf2a178-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
264 |
FOREIGN KEY (`device_id` )
|
|
|
265 |
REFERENCES `camp2`.`device` (`device_id` ),
|
|
|
266 |
CONSTRAINT `fk_ecf2a47a-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
267 |
FOREIGN KEY (`attribute_id` )
|
|
|
268 |
REFERENCES `camp2`.`attribute` (`attribute_id` )
|
|
|
269 |
ON DELETE RESTRICT
|
|
|
270 |
ON UPDATE RESTRICT,
|
|
|
271 |
CONSTRAINT `fk_device_attribute_1`
|
|
|
272 |
FOREIGN KEY (`_user_id` )
|
|
|
273 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
274 |
ON DELETE NO ACTION
|
|
|
275 |
ON UPDATE NO ACTION)
|
|
|
276 |
ENGINE = InnoDB
|
|
|
277 |
COMMENT = 'stores various attribute values for the device table keeping' /* comment truncated */;
|
|
|
278 |
|
|
|
279 |
|
|
|
280 |
-- -----------------------------------------------------
|
|
|
281 |
-- Table `camp2`.`client_attribute`
|
|
|
282 |
-- -----------------------------------------------------
|
|
|
283 |
DROP TABLE IF EXISTS `camp2`.`client_attribute` ;
|
|
|
284 |
|
|
|
285 |
CREATE TABLE IF NOT EXISTS `camp2`.`client_attribute` (
|
|
|
286 |
`client_attribute_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
287 |
`client_id` INT UNSIGNED NOT NULL ,
|
|
|
288 |
`attribute_id` INT UNSIGNED NOT NULL ,
|
|
|
289 |
`report_value` TEXT NULL DEFAULT NULL ,
|
|
|
290 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
291 |
`added_date` DATETIME NOT NULL ,
|
|
|
292 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
293 |
PRIMARY KEY (`client_attribute_id`) ,
|
|
|
294 |
INDEX (`client_id` ASC, `attribute_id` ASC, `added_date` ASC, `removed_date` ASC) ,
|
|
|
295 |
INDEX `fk_ecf2c356-d2bf-11e5-94fa-e0cb4ed780b9` (`attribute_id` ASC) ,
|
|
|
296 |
INDEX `fk_client_attribute_1` (`_user_id` ASC) ,
|
|
|
297 |
CONSTRAINT `fk_ecf2c0b8-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
298 |
FOREIGN KEY (`client_id` )
|
|
|
299 |
REFERENCES `camp2`.`client` (`client_id` )
|
|
|
300 |
ON DELETE RESTRICT
|
|
|
301 |
ON UPDATE RESTRICT,
|
|
|
302 |
CONSTRAINT `fk_ecf2c356-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
303 |
FOREIGN KEY (`attribute_id` )
|
|
|
304 |
REFERENCES `camp2`.`attribute` (`attribute_id` ),
|
|
|
305 |
CONSTRAINT `fk_client_attribute_1`
|
|
|
306 |
FOREIGN KEY (`_user_id` )
|
|
|
307 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
308 |
ON DELETE NO ACTION
|
|
|
309 |
ON UPDATE NO ACTION)
|
|
|
310 |
ENGINE = InnoDB
|
|
|
311 |
COMMENT = 'stores various attribute values for the client table keeping' /* comment truncated */;
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
-- -----------------------------------------------------
|
|
|
315 |
-- Table `camp2`.`location_attribute`
|
|
|
316 |
-- -----------------------------------------------------
|
|
|
317 |
DROP TABLE IF EXISTS `camp2`.`location_attribute` ;
|
|
|
318 |
|
|
|
319 |
CREATE TABLE IF NOT EXISTS `camp2`.`location_attribute` (
|
|
|
320 |
`location_attribute_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
321 |
`location_id` INT UNSIGNED NOT NULL ,
|
|
|
322 |
`attribute_id` INT UNSIGNED NOT NULL ,
|
|
|
323 |
`report_value` TEXT NULL DEFAULT NULL ,
|
|
|
324 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
325 |
`added_date` DATETIME NOT NULL ,
|
|
|
326 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
327 |
PRIMARY KEY (`location_attribute_id`) ,
|
|
|
328 |
INDEX (`location_id` ASC, `attribute_id` ASC, `added_date` ASC, `removed_date` ASC) ,
|
|
|
329 |
INDEX `fk_ecf2e2c8-d2bf-11e5-94fa-e0cb4ed780b9` (`attribute_id` ASC) ,
|
|
|
330 |
INDEX `fk_location_attribute_1` (`_user_id` ASC) ,
|
|
|
331 |
CONSTRAINT `fk_ecf2e03e-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
332 |
FOREIGN KEY (`location_id` )
|
|
|
333 |
REFERENCES `camp2`.`location` (`location_id` )
|
|
|
334 |
ON DELETE RESTRICT
|
|
|
335 |
ON UPDATE RESTRICT,
|
|
|
336 |
CONSTRAINT `fk_ecf2e2c8-d2bf-11e5-94fa-e0cb4ed780b9`
|
|
|
337 |
FOREIGN KEY (`attribute_id` )
|
|
|
338 |
REFERENCES `camp2`.`attribute` (`attribute_id` ),
|
|
|
339 |
CONSTRAINT `fk_location_attribute_1`
|
|
|
340 |
FOREIGN KEY (`_user_id` )
|
|
|
341 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
342 |
ON DELETE NO ACTION
|
|
|
343 |
ON UPDATE NO ACTION)
|
|
|
344 |
ENGINE = InnoDB
|
|
|
345 |
COMMENT = 'stores various attribute values for the location table keepi' /* comment truncated */;
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
-- -----------------------------------------------------
|
|
|
349 |
-- Table `camp2`.`_system`
|
|
|
350 |
-- -----------------------------------------------------
|
|
|
351 |
DROP TABLE IF EXISTS `camp2`.`_system` ;
|
|
|
352 |
|
|
|
353 |
CREATE TABLE IF NOT EXISTS `camp2`.`_system` (
|
|
|
354 |
`_system_id` INT NOT NULL AUTO_INCREMENT ,
|
|
|
355 |
`group_name` VARCHAR(45) NOT NULL ,
|
|
|
356 |
`key_name` VARCHAR(45) NOT NULL ,
|
|
|
357 |
`key_value` VARCHAR(45) NOT NULL ,
|
|
|
358 |
PRIMARY KEY (`_system_id`) )
|
|
|
359 |
ENGINE = InnoDB
|
|
|
360 |
COMMENT = 'Stores internal system information like ini file';
|
|
|
361 |
|
|
|
362 |
|
|
|
363 |
-- -----------------------------------------------------
|
|
|
364 |
-- Table `camp2`.`_menu`
|
|
|
365 |
-- -----------------------------------------------------
|
|
|
366 |
DROP TABLE IF EXISTS `camp2`.`_menu` ;
|
|
|
367 |
|
|
|
368 |
CREATE TABLE IF NOT EXISTS `camp2`.`_menu` (
|
|
|
369 |
`_menu_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
370 |
`parent_id` INT UNSIGNED NULL DEFAULT NULL ,
|
|
|
371 |
`caption` VARCHAR(20) NOT NULL ,
|
|
|
372 |
`url` VARCHAR(64) NULL ,
|
|
|
373 |
PRIMARY KEY (`_menu_id`) )
|
|
|
374 |
ENGINE = InnoDB
|
|
|
375 |
COMMENT = 'Menus for the application';
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
-- -----------------------------------------------------
|
|
|
379 |
-- Table `camp2`.`software`
|
|
|
380 |
-- -----------------------------------------------------
|
|
|
381 |
DROP TABLE IF EXISTS `camp2`.`software` ;
|
|
|
382 |
|
|
|
383 |
CREATE TABLE IF NOT EXISTS `camp2`.`software` (
|
|
|
384 |
`software_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
385 |
`name` VARCHAR(64) NOT NULL COMMENT 'name of the software package' ,
|
|
|
386 |
`description` TEXT NULL DEFAULT NULL COMMENT 'optional multiline description of package' ,
|
|
|
387 |
`added_date` DATETIME NULL ,
|
|
|
388 |
PRIMARY KEY (`software_id`) )
|
|
|
389 |
ENGINE = InnoDB;
|
|
|
390 |
|
|
|
391 |
|
|
|
392 |
-- -----------------------------------------------------
|
|
|
393 |
-- Table `camp2`.`software_version`
|
|
|
394 |
-- -----------------------------------------------------
|
|
|
395 |
DROP TABLE IF EXISTS `camp2`.`software_version` ;
|
|
|
396 |
|
|
|
397 |
CREATE TABLE IF NOT EXISTS `camp2`.`software_version` (
|
|
|
398 |
`software_version_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
399 |
`name` VARCHAR(64) NOT NULL COMMENT 'full version identifier, possibly version and release or other data' ,
|
|
|
400 |
`added_date` DATETIME NOT NULL ,
|
|
|
401 |
PRIMARY KEY (`software_version_id`) )
|
|
|
402 |
ENGINE = InnoDB;
|
|
|
403 |
|
|
|
404 |
|
|
|
405 |
-- -----------------------------------------------------
|
|
|
406 |
-- Table `camp2`.`device_software`
|
|
|
407 |
-- -----------------------------------------------------
|
|
|
408 |
DROP TABLE IF EXISTS `camp2`.`device_software` ;
|
|
|
409 |
|
|
|
410 |
CREATE TABLE IF NOT EXISTS `camp2`.`device_software` (
|
|
|
411 |
`device_software_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
412 |
`device_id` INT UNSIGNED NOT NULL ,
|
|
|
413 |
`software_id` INT UNSIGNED NOT NULL ,
|
|
|
414 |
`software_version_id` INT UNSIGNED NOT NULL ,
|
|
|
415 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
416 |
`added_date` DATETIME NOT NULL ,
|
|
|
417 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
418 |
PRIMARY KEY (`device_software_id`) ,
|
|
|
419 |
INDEX `fk_device_software_1` (`device_id` ASC) ,
|
|
|
420 |
INDEX `fk_device_software_2` (`device_id` ASC) ,
|
|
|
421 |
INDEX `fk_device_software_3` (`software_version_id` ASC) ,
|
|
|
422 |
INDEX `fk_device_software_4` (`_user_id` ASC) ,
|
|
|
423 |
CONSTRAINT `fk_device_software_1`
|
|
|
424 |
FOREIGN KEY (`device_id` )
|
|
|
425 |
REFERENCES `camp2`.`device` (`device_id` )
|
|
|
426 |
ON DELETE NO ACTION
|
|
|
427 |
ON UPDATE NO ACTION,
|
|
|
428 |
CONSTRAINT `fk_device_software_2`
|
|
|
429 |
FOREIGN KEY (`device_id` )
|
|
|
430 |
REFERENCES `camp2`.`software` (`software_id` )
|
|
|
431 |
ON DELETE NO ACTION
|
|
|
432 |
ON UPDATE NO ACTION,
|
|
|
433 |
CONSTRAINT `fk_device_software_3`
|
|
|
434 |
FOREIGN KEY (`software_version_id` )
|
|
|
435 |
REFERENCES `camp2`.`software_version` (`software_version_id` )
|
|
|
436 |
ON DELETE NO ACTION
|
|
|
437 |
ON UPDATE NO ACTION,
|
|
|
438 |
CONSTRAINT `fk_device_software_4`
|
|
|
439 |
FOREIGN KEY (`_user_id` )
|
|
|
440 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
441 |
ON DELETE NO ACTION
|
|
|
442 |
ON UPDATE NO ACTION)
|
|
|
443 |
ENGINE = InnoDB;
|
|
|
444 |
|
|
|
445 |
|
|
|
446 |
-- -----------------------------------------------------
|
|
|
447 |
-- Table `camp2`.`device_network`
|
|
|
448 |
-- -----------------------------------------------------
|
|
|
449 |
DROP TABLE IF EXISTS `camp2`.`device_network` ;
|
|
|
450 |
|
|
|
451 |
CREATE TABLE IF NOT EXISTS `camp2`.`device_network` (
|
|
|
452 |
`device_network_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
453 |
`device_id` INT UNSIGNED NOT NULL ,
|
|
|
454 |
`interface` VARCHAR(32) NOT NULL COMMENT 'interface name' ,
|
|
|
455 |
`address` CHAR(15) NULL COMMENT 'IPv4 Address' ,
|
|
|
456 |
`netmask` CHAR(15) NULL COMMENT 'IPv4 netmask' ,
|
|
|
457 |
`ip6_address` VARCHAR(32) NULL COMMENT 'IPv6 Address' ,
|
|
|
458 |
`ip6_net` INT NULL COMMENT 'ipv6 netmask' ,
|
|
|
459 |
`mtu` INT NULL COMMENT 'MTU of connection' ,
|
|
|
460 |
`mac` VARCHAR(20) NULL COMMENT 'mac address of device' ,
|
|
|
461 |
`added_date` DATETIME NOT NULL ,
|
|
|
462 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
463 |
PRIMARY KEY (`device_network_id`) ,
|
|
|
464 |
INDEX `fk_device_network_1` (`device_id` ASC) ,
|
|
|
465 |
CONSTRAINT `fk_device_network_1`
|
|
|
466 |
FOREIGN KEY (`device_id` )
|
|
|
467 |
REFERENCES `camp2`.`device` (`device_id` )
|
|
|
468 |
ON DELETE NO ACTION
|
|
|
469 |
ON UPDATE NO ACTION)
|
|
|
470 |
ENGINE = InnoDB;
|
|
|
471 |
|
|
|
472 |
|
|
|
473 |
-- -----------------------------------------------------
|
|
|
474 |
-- Table `camp2`.`sysinfo_report`
|
|
|
475 |
-- -----------------------------------------------------
|
|
|
476 |
DROP TABLE IF EXISTS `camp2`.`sysinfo_report` ;
|
|
|
477 |
|
|
|
478 |
CREATE TABLE IF NOT EXISTS `camp2`.`sysinfo_report` (
|
|
|
479 |
`sysinfo_report_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
480 |
`device_id` INT UNSIGNED NULL ,
|
|
|
481 |
`client_version` VARCHAR(5) NULL COMMENT 'Version of the sysinfo client reporting this' ,
|
|
|
482 |
`report_date` DATETIME NOT NULL COMMENT 'Date on the report itself' ,
|
|
|
483 |
`processed_date` DATETIME NOT NULL COMMENT 'Date it was put into the system' ,
|
|
|
484 |
PRIMARY KEY (`sysinfo_report_id`) ,
|
|
|
485 |
INDEX `fk_sysinfo_report_1` (`device_id` ASC) ,
|
|
|
486 |
INDEX `device_date` (`device_id` ASC, `report_date` ASC) ,
|
|
|
487 |
CONSTRAINT `fk_sysinfo_report_1`
|
|
|
488 |
FOREIGN KEY (`device_id` )
|
|
|
489 |
REFERENCES `camp2`.`device` (`device_id` )
|
|
|
490 |
ON DELETE NO ACTION
|
|
|
491 |
ON UPDATE NO ACTION)
|
|
|
492 |
ENGINE = InnoDB;
|
|
|
493 |
|
|
|
494 |
|
|
|
495 |
-- -----------------------------------------------------
|
|
|
496 |
-- Table `camp2`.`maintenance_task`
|
|
|
497 |
-- -----------------------------------------------------
|
|
|
498 |
DROP TABLE IF EXISTS `camp2`.`maintenance_task` ;
|
|
|
499 |
|
|
|
500 |
CREATE TABLE IF NOT EXISTS `camp2`.`maintenance_task` (
|
|
|
501 |
`maintenance_task_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
502 |
`name` VARCHAR(64) NOT NULL COMMENT 'Listing of different maintenance tasks to be performed' ,
|
|
|
503 |
`description` TEXT NULL ,
|
|
|
504 |
`default_period` INT NOT NULL DEFAULT 7 ,
|
|
|
505 |
PRIMARY KEY (`maintenance_task_id`) )
|
|
|
506 |
ENGINE = InnoDB
|
|
|
507 |
COMMENT = 'list of maintenance tasks which can be performed';
|
|
|
508 |
|
|
|
509 |
|
|
|
510 |
-- -----------------------------------------------------
|
|
|
511 |
-- Table `camp2`.`maintenance_schedule`
|
|
|
512 |
-- -----------------------------------------------------
|
|
|
513 |
DROP TABLE IF EXISTS `camp2`.`maintenance_schedule` ;
|
|
|
514 |
|
|
|
515 |
CREATE TABLE IF NOT EXISTS `camp2`.`maintenance_schedule` (
|
|
|
516 |
`maintenance_schedule_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
517 |
`device_id` INT UNSIGNED NOT NULL ,
|
|
|
518 |
`maintenance_task_id` INT UNSIGNED NOT NULL ,
|
|
|
519 |
`schedule` INT NOT NULL DEFAULT 7 ,
|
|
|
520 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
521 |
`added_date` DATETIME NOT NULL ,
|
|
|
522 |
`removed_date` DATETIME NULL DEFAULT NULL ,
|
|
|
523 |
PRIMARY KEY (`maintenance_schedule_id`) ,
|
|
|
524 |
INDEX `fk_maintenance_schedule_device` (`device_id` ASC) ,
|
|
|
525 |
INDEX `fk_maintenance_schedule_task` (`maintenance_task_id` ASC) ,
|
|
|
526 |
INDEX `fk_maintenance_schedule_user` (`_user_id` ASC) ,
|
|
|
527 |
CONSTRAINT `fk_maintenance_schedule_device`
|
|
|
528 |
FOREIGN KEY (`device_id` )
|
|
|
529 |
REFERENCES `camp2`.`device` (`device_id` )
|
|
|
530 |
ON DELETE NO ACTION
|
|
|
531 |
ON UPDATE NO ACTION,
|
|
|
532 |
CONSTRAINT `fk_maintenance_schedule_task`
|
|
|
533 |
FOREIGN KEY (`maintenance_task_id` )
|
|
|
534 |
REFERENCES `camp2`.`maintenance_task` (`maintenance_task_id` )
|
|
|
535 |
ON DELETE NO ACTION
|
|
|
536 |
ON UPDATE NO ACTION,
|
|
|
537 |
CONSTRAINT `fk_maintenance_schedule_user`
|
|
|
538 |
FOREIGN KEY (`_user_id` )
|
|
|
539 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
540 |
ON DELETE NO ACTION
|
|
|
541 |
ON UPDATE NO ACTION)
|
|
|
542 |
ENGINE = InnoDB
|
|
|
543 |
COMMENT = 'desired schedule of maintenance for machine';
|
|
|
544 |
|
|
|
545 |
|
|
|
546 |
-- -----------------------------------------------------
|
|
|
547 |
-- Table `camp2`.`maintenance_performed`
|
|
|
548 |
-- -----------------------------------------------------
|
|
|
549 |
DROP TABLE IF EXISTS `camp2`.`maintenance_performed` ;
|
|
|
550 |
|
|
|
551 |
CREATE TABLE IF NOT EXISTS `camp2`.`maintenance_performed` (
|
|
|
552 |
`maintenance_performed_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
553 |
`device_id` INT UNSIGNED NOT NULL ,
|
|
|
554 |
`maintenance_task_id` INT UNSIGNED NOT NULL ,
|
|
|
555 |
`date_performed` DATETIME NOT NULL COMMENT 'date technician performed the maintenanc' ,
|
|
|
556 |
`_user_id` INT UNSIGNED NOT NULL ,
|
|
|
557 |
`notes` TEXT NULL COMMENT 'any notes the technician wants to make' ,
|
|
|
558 |
PRIMARY KEY (`maintenance_performed_id`) ,
|
|
|
559 |
INDEX `fk_maintenance_performed_task` (`maintenance_task_id` ASC) ,
|
|
|
560 |
INDEX `fk_maintenance_performed_device` (`device_id` ASC) ,
|
|
|
561 |
INDEX `fk_maintenance_performed_user` (`_user_id` ASC) ,
|
|
|
562 |
CONSTRAINT `fk_maintenance_performed_task`
|
|
|
563 |
FOREIGN KEY (`maintenance_task_id` )
|
|
|
564 |
REFERENCES `camp2`.`maintenance_task` (`maintenance_task_id` )
|
|
|
565 |
ON DELETE NO ACTION
|
|
|
566 |
ON UPDATE NO ACTION,
|
|
|
567 |
CONSTRAINT `fk_maintenance_performed_device`
|
|
|
568 |
FOREIGN KEY (`device_id` )
|
|
|
569 |
REFERENCES `camp2`.`device` (`device_id` )
|
|
|
570 |
ON DELETE NO ACTION
|
|
|
571 |
ON UPDATE NO ACTION,
|
|
|
572 |
CONSTRAINT `fk_maintenance_performed_user`
|
|
|
573 |
FOREIGN KEY (`_user_id` )
|
|
|
574 |
REFERENCES `camp2`.`_user` (`_user_id` )
|
|
|
575 |
ON DELETE NO ACTION
|
|
|
576 |
ON UPDATE NO ACTION)
|
|
|
577 |
ENGINE = InnoDB
|
|
|
578 |
COMMENT = 'maintenance actually performed on equipment';
|
|
|
579 |
|
|
|
580 |
|
|
|
581 |
-- -----------------------------------------------------
|
|
|
582 |
-- Table `camp2`.`maintenance_group`
|
|
|
583 |
-- -----------------------------------------------------
|
|
|
584 |
DROP TABLE IF EXISTS `camp2`.`maintenance_group` ;
|
|
|
585 |
|
|
|
586 |
CREATE TABLE IF NOT EXISTS `camp2`.`maintenance_group` (
|
|
|
587 |
`maintenance_group_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
588 |
`name` VARCHAR(45) NOT NULL COMMENT 'name of the task group' ,
|
|
|
589 |
`notes` TEXT NULL COMMENT 'any notes' ,
|
|
|
590 |
`last_modified` TIMESTAMP NULL ,
|
|
|
591 |
PRIMARY KEY (`maintenance_group_id`) )
|
|
|
592 |
ENGINE = InnoDB;
|
|
|
593 |
|
|
|
594 |
|
|
|
595 |
-- -----------------------------------------------------
|
|
|
596 |
-- Table `camp2`.`maintenance_group_task`
|
|
|
597 |
-- -----------------------------------------------------
|
|
|
598 |
DROP TABLE IF EXISTS `camp2`.`maintenance_group_task` ;
|
|
|
599 |
|
|
|
600 |
CREATE TABLE IF NOT EXISTS `camp2`.`maintenance_group_task` (
|
|
|
601 |
`maintenance_group_task_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
|
|
602 |
`maintenance_task_id` INT UNSIGNED NOT NULL ,
|
|
|
603 |
`maintenance_group_id` INT UNSIGNED NOT NULL ,
|
|
|
604 |
`default_period` INT NULL DEFAULT NULL COMMENT 'ability to change the default period for a task' ,
|
|
|
605 |
PRIMARY KEY (`maintenance_group_task_id`) ,
|
|
|
606 |
INDEX `fk_maintenance_group_task_group` (`maintenance_group_id` ASC) ,
|
|
|
607 |
INDEX `fk_maintenance_group_task_task` (`maintenance_task_id` ASC) ,
|
|
|
608 |
CONSTRAINT `fk_maintenance_group_task_group`
|
|
|
609 |
FOREIGN KEY (`maintenance_group_id` )
|
|
|
610 |
REFERENCES `camp2`.`maintenance_group` (`maintenance_group_id` )
|
|
|
611 |
ON DELETE NO ACTION
|
|
|
612 |
ON UPDATE NO ACTION,
|
|
|
613 |
CONSTRAINT `fk_maintenance_group_task_task`
|
|
|
614 |
FOREIGN KEY (`maintenance_task_id` )
|
|
|
615 |
REFERENCES `camp2`.`maintenance_task` (`maintenance_task_id` )
|
|
|
616 |
ON DELETE NO ACTION
|
|
|
617 |
ON UPDATE NO ACTION)
|
|
|
618 |
ENGINE = InnoDB;
|
|
|
619 |
|
|
|
620 |
|
|
|
621 |
-- -----------------------------------------------------
|
|
|
622 |
-- Placeholder table for view `camp2`.`v_client_attribute`
|
|
|
623 |
-- -----------------------------------------------------
|
|
|
624 |
CREATE TABLE IF NOT EXISTS `camp2`.`v_client_attribute` (`attribute_id` INT, `name` INT, `report_name` INT, `category_id` INT);
|
|
|
625 |
|
|
|
626 |
-- -----------------------------------------------------
|
|
|
627 |
-- Placeholder table for view `camp2`.`v_current_device`
|
|
|
628 |
-- -----------------------------------------------------
|
|
|
629 |
CREATE TABLE IF NOT EXISTS `camp2`.`v_current_device` (`device_id` INT, `name` INT, `device_type_id` INT, `_user_id` INT, `added_date` INT, `removed_date` INT);
|
|
|
630 |
|
|
|
631 |
-- -----------------------------------------------------
|
|
|
632 |
-- Placeholder table for view `camp2`.`v_current_client`
|
|
|
633 |
-- -----------------------------------------------------
|
|
|
634 |
CREATE TABLE IF NOT EXISTS `camp2`.`v_current_client` (`client_id` INT, `name` INT, `_user_id` INT, `added_date` INT, `removed_date` INT);
|
|
|
635 |
|
|
|
636 |
-- -----------------------------------------------------
|
|
|
637 |
-- Placeholder table for view `camp2`.`v_current_location`
|
|
|
638 |
-- -----------------------------------------------------
|
|
|
639 |
CREATE TABLE IF NOT EXISTS `camp2`.`v_current_location` (`location_id` INT, `name` INT, `_user_id` INT, `added_date` INT, `removed_date` INT);
|
|
|
640 |
|
|
|
641 |
-- -----------------------------------------------------
|
|
|
642 |
-- View `camp2`.`v_client_attribute`
|
|
|
643 |
-- -----------------------------------------------------
|
|
|
644 |
DROP VIEW IF EXISTS `camp2`.`v_client_attribute` ;
|
|
|
645 |
DROP TABLE IF EXISTS `camp2`.`v_client_attribute`;
|
|
|
646 |
USE `camp2`;
|
|
|
647 |
CREATE OR REPLACE VIEW `camp2`.`v_client_attribute` AS
|
|
|
648 |
select
|
|
|
649 |
attribute.attribute_id,
|
|
|
650 |
attribute.name,
|
|
|
651 |
attribute.report_name,
|
|
|
652 |
attribute.category_id
|
|
|
653 |
from attribute join category using (category_id)
|
|
|
654 |
where category.name = 'client';
|
|
|
655 |
;
|
|
|
656 |
|
|
|
657 |
-- -----------------------------------------------------
|
|
|
658 |
-- View `camp2`.`v_current_device`
|
|
|
659 |
-- -----------------------------------------------------
|
|
|
660 |
DROP VIEW IF EXISTS `camp2`.`v_current_device` ;
|
|
|
661 |
DROP TABLE IF EXISTS `camp2`.`v_current_device`;
|
|
|
662 |
USE `camp2`;
|
|
|
663 |
CREATE OR REPLACE VIEW `camp2`.`v_current_device` AS
|
|
|
664 |
select * from device where device.removed_date is null;
|
|
|
665 |
;
|
|
|
666 |
|
|
|
667 |
-- -----------------------------------------------------
|
|
|
668 |
-- View `camp2`.`v_current_client`
|
|
|
669 |
-- -----------------------------------------------------
|
|
|
670 |
DROP VIEW IF EXISTS `camp2`.`v_current_client` ;
|
|
|
671 |
DROP TABLE IF EXISTS `camp2`.`v_current_client`;
|
|
|
672 |
USE `camp2`;
|
|
|
673 |
CREATE OR REPLACE VIEW `camp2`.`v_current_client` AS
|
|
|
674 |
select * from client where removed_date is null;
|
|
|
675 |
;
|
|
|
676 |
|
|
|
677 |
-- -----------------------------------------------------
|
|
|
678 |
-- View `camp2`.`v_current_location`
|
|
|
679 |
-- -----------------------------------------------------
|
|
|
680 |
DROP VIEW IF EXISTS `camp2`.`v_current_location` ;
|
|
|
681 |
DROP TABLE IF EXISTS `camp2`.`v_current_location`;
|
|
|
682 |
USE `camp2`;
|
|
|
683 |
CREATE OR REPLACE VIEW `camp2`.`v_current_location` AS
|
|
|
684 |
select * from location where location.removed_date is null
|
|
|
685 |
;
|
|
|
686 |
|
|
|
687 |
|
|
|
688 |
SET SQL_MODE=@OLD_SQL_MODE;
|
|
|
689 |
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
|
|
690 |
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|