· 7 years ago · Feb 24, 2019, 05:46 AM
1CREATE TABLE IF NOT EXISTS `questions` (
2 `question_id` int(11) NOT NULL AUTO_INCREMENT,
3 `createddate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
4 `updateddate` timestamp NULL DEFAULT NULL,
5 `active_flag` tinyint(4) NOT NULL DEFAULT '0',
6 PRIMARY KEY (`question_id`),
7 UNIQUE KEY `id_UNIQUE` (`question_id`)
8) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
9
10CREATE TABLE `alarts` (
11 `alart_id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT,
12 `alart_name` varchar(45) NOT NULL,
13 `interval` int(10) unsigned NOT NULL,
14 `alart_sent_counter` int(10) unsigned NOT NULL,
15 `alart_types_id` BIGINT(20) unsigned NOT NULL,
16 `contact_group_id` int(10) unsigned NOT NULL,
17 PRIMARY KEY (`alart_id`),
18 FOREIGN KEY (`alart_types_id`) REFERENCES alart_types(`alart_types_id`)
19) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
20
21CREATE TABLE `alart_question_mapping` (
22`alart_question_mapping_id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT,
23`question_id` int(11) NOT NULL,
24`alart_id` BIGINT(20) unsigned NOT NULL,
25PRIMARY KEY (`alart_question_mapping_id`),
26FOREIGN KEY (`question_id`) REFERENCES questions(`question_id`),
27FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_id`)
28) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
29
30FOREIGN KEY (`alart_id`) REFERENCES alart(`alart_id`)
31
32FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_id`)
33
34FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_id`)
35
36FOREIGN KEY (`alart_id`) REFERENCES alarts(`alart_id`)
37
38FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_id`)
39
40CREATE TABLE `alart_question_mapping` (
41`alart_question_mapping_id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT,
42`question_id` int(11) NOT NULL,
43`alart_id` BIGINT(20) unsigned NOT NULL,
44PRIMARY KEY (`alart_question_mapping_id`),
45FOREIGN KEY (`question_id`) REFERENCES questions(`question_id`),
46FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_id`)
47)
48
49CREATE TABLE `alart_question_mapping` (
50`alart_question_mapping_id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT,
51`question_id` int(11) NOT NULL,
52`alart_id` BIGINT(20) unsigned NOT NULL,
53PRIMARY KEY (`alart_question_mapping_id`),
54FOREIGN KEY (`question_id`) REFERENCES questions(`question_id`),
55FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_types_id`)
56) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
57
58FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_id`)
59
60FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_types_id`)
61
62CREATE TABLE alart_types (
63 alart_types_id BIGINT(20) unsigned NOT NULL AUTO_INCREMENT,
64 alarts_types_name varchar(45) NOT NULL,
65 PRIMARY KEY (alart_types_id)
66) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
67
681 Warning
692 Critical
703 Warning
714 Warning
72
73FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_id`)
74
75FOREIGN KEY (`alart_id`) REFERENCES alart_types(`alart_types_id`)