forked from neilmunday/Salt-Minion-Inventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
173 lines (144 loc) · 5.4 KB
/
database.sql
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
DROP TABLE IF EXISTS `gpu`;
CREATE TABLE `gpu` (
`gpu_id` smallint(5) unsigned NOT NULL,
`gpu_model` varchar(255) NOT NULL,
`vendor_id` smallint(5) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `interface`;
CREATE TABLE `interface` (
`interface_id` smallint(5) unsigned NOT NULL,
`interface_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minion`;
CREATE TABLE `minion` (
`server_id` int(11) unsigned NOT NULL,
`boot_time` int(11) unsigned DEFAULT NULL,
`last_audit` int(11) unsigned DEFAULT NULL,
`last_seen` int(11) unsigned DEFAULT NULL,
`id` varchar(255) NOT NULL,
`server_model_id` smallint(5) unsigned NOT NULL,
`server_serial` varchar(255) NOT NULL,
`biosreleasedate` varchar(255) DEFAULT NULL,
`biosversion` varchar(255) DEFAULT NULL,
`cpu_model` varchar(255) DEFAULT NULL,
`fqdn` text,
`host` varchar(255) DEFAULT NULL,
`kernel` varchar(255) DEFAULT NULL,
`kernelrelease` varchar(255) DEFAULT NULL,
`mem_total` mediumint(8) unsigned NOT NULL DEFAULT '0',
`num_cpus` smallint(5) unsigned NOT NULL DEFAULT '0',
`num_gpus` int(10) unsigned NOT NULL DEFAULT '0',
`os` varchar(255) DEFAULT NULL,
`osrelease` varchar(255) DEFAULT NULL,
`saltversion` varchar(255) DEFAULT NULL,
`package_total` smallint(5) unsigned NOT NULL DEFAULT '0',
`selinux_enabled` tinyint(1) NOT NULL,
`selinux_enforced` enum('Permissive','Enforcing','Disabled','') NOT NULL DEFAULT 'Disabled'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minion_disk`;
CREATE TABLE `minion_disk` (
`server_id` int(11) unsigned NOT NULL,
`disk_path` varchar(255) NOT NULL,
`disk_serial` text NOT NULL,
`disk_size` float unsigned NOT NULL,
`vendor_id` smallint(5) unsigned NOT NULL,
`present` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minion_gpu`;
CREATE TABLE `minion_gpu` (
`server_id` int(11) unsigned NOT NULL,
`gpu_id` smallint(5) unsigned NOT NULL,
`gpu_qty` smallint(5) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minion_interface`;
CREATE TABLE `minion_interface` (
`server_id` int(11) NOT NULL,
`interface_id` smallint(6) NOT NULL,
`mac` varchar(17) NOT NULL,
`present` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minion_ip4`;
CREATE TABLE `minion_ip4` (
`server_id` int(10) unsigned NOT NULL,
`interface_id` smallint(5) unsigned NOT NULL,
`ip4` varchar(15) NOT NULL,
`present` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minion_package`;
CREATE TABLE `minion_package` (
`server_id` int(11) unsigned NOT NULL,
`package_id` mediumint(8) unsigned NOT NULL,
`package_version` varchar(255) NOT NULL,
`present` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `minion_user`;
CREATE TABLE `minion_user` (
`server_id` int(11) unsigned NOT NULL,
`user_id` smallint(5) unsigned NOT NULL,
`present` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `package`;
CREATE TABLE `package` (
`package_id` mediumint(8) unsigned NOT NULL,
`package_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `server_model`;
CREATE TABLE `server_model` (
`server_model_id` smallint(5) unsigned NOT NULL,
`server_model` tinytext NOT NULL,
`vendor_id` smallint(5) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`user_id` smallint(5) unsigned NOT NULL,
`user_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `vendor`;
CREATE TABLE `vendor` (
`vendor_id` smallint(5) unsigned NOT NULL,
`vendor_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='vendor';
ALTER TABLE `gpu`
ADD PRIMARY KEY (`gpu_id`);
ALTER TABLE `interface`
ADD PRIMARY KEY (`interface_id`);
ALTER TABLE `minion`
ADD PRIMARY KEY (`server_id`),
ADD UNIQUE KEY `id` (`id`),
ADD KEY `host` (`host`);
ALTER TABLE `minion_disk`
ADD PRIMARY KEY (`server_id`,`disk_path`);
ALTER TABLE `minion_gpu`
ADD PRIMARY KEY (`server_id`,`gpu_id`);
ALTER TABLE `minion_interface`
ADD PRIMARY KEY (`server_id`,`interface_id`);
ALTER TABLE `minion_ip4`
ADD PRIMARY KEY (`server_id`,`interface_id`,`ip4`);
ALTER TABLE `minion_package`
ADD PRIMARY KEY (`server_id`,`package_id`,`package_version`) USING BTREE,
ADD KEY `serverId` (`server_id`);
ALTER TABLE `minion_user`
ADD PRIMARY KEY (`server_id`,`user_id`);
ALTER TABLE `package`
ADD PRIMARY KEY (`package_id`),
ADD UNIQUE KEY `package_name` (`package_name`);
ALTER TABLE `server_model`
ADD PRIMARY KEY (`server_model_id`);
ALTER TABLE `user`
ADD PRIMARY KEY (`user_id`);
ALTER TABLE `vendor`
ADD PRIMARY KEY (`vendor_id`);
ALTER TABLE `gpu`
MODIFY `gpu_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE `interface`
MODIFY `interface_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE `package`
MODIFY `package_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE `server_model`
MODIFY `server_model_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE `user`
MODIFY `user_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT;
ALTER TABLE `vendor`
MODIFY `vendor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT;