View erstellt und diverse kleine Anpassungen
View für das Netzwerkinterface erstellt. Diverse kleine anpassungen
This commit is contained in:
parent
54cbd577ca
commit
925ba2c605
@ -72,7 +72,7 @@ FOREIGN KEY (`location_fk`) REFERENCES `location`(`location_id`) ON DELETE CASCA
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DeviceType (
|
CREATE TABLE IF NOT EXISTS DeviceType (
|
||||||
deviceType_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
deviceType_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
manifacturer VARCHAR(255) NOT NULL,
|
manufacturer VARCHAR(255) NOT NULL,
|
||||||
model VARCHAR(255) NOT NULL,
|
model VARCHAR(255) NOT NULL,
|
||||||
version VARCHAR(255) NULL,
|
version VARCHAR(255) NULL,
|
||||||
PRIMARY KEY (deviceType_id)
|
PRIMARY KEY (deviceType_id)
|
||||||
@ -128,20 +128,18 @@ FOREIGN KEY (network_fk) REFERENCES Network (network_id)ON DELETE CASCADE,
|
|||||||
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE
|
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Medium (
|
CREATE TABLE IF NOT EXISTS Transportmedium (
|
||||||
medium_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
transportmedium_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
description VARCHAR(45) NOT NULL,
|
description VARCHAR(45) NOT NULL
|
||||||
device_fk INT UNSIGNED NOT NULL,
|
|
||||||
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Port (
|
CREATE TABLE IF NOT EXISTS Deviceport (
|
||||||
port_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
deviceport_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
description VARCHAR(45) NOT NULL,
|
description VARCHAR(45) NOT NULL,
|
||||||
device_fk INT UNSIGNED NOT NULL,
|
device_fk INT UNSIGNED NOT NULL,
|
||||||
medium_fk INT UNSIGNED NOT NULL,
|
transportmedium_fk INT UNSIGNED NOT NULL,
|
||||||
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE,
|
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE,
|
||||||
FOREIGN KEY (Medium_fk) REFERENCES Medium (medium_id)ON DELETE CASCADE
|
FOREIGN KEY (transportmedium_fk) REFERENCES Transportmedium (transportmedium_id)ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE Table IF NOT EXISTS Log (
|
CREATE Table IF NOT EXISTS Log (
|
||||||
|
@ -68,7 +68,7 @@ VALUES
|
|||||||
(4,'192.168.1.0','255.255.255.0',1,'Labor'),
|
(4,'192.168.1.0','255.255.255.0',1,'Labor'),
|
||||||
(5,'192.168.128.0','255.255.255.127',1,'Integration');
|
(5,'192.168.128.0','255.255.255.127',1,'Integration');
|
||||||
|
|
||||||
INSERT INTO DevicesTypes(manifacture, model, version)
|
INSERT INTO DeviceType (manufacturer, model, version)
|
||||||
VALUES
|
VALUES
|
||||||
('Cisco','Router',''),
|
('Cisco','Router',''),
|
||||||
('Avaya','PBX',''),
|
('Avaya','PBX',''),
|
||||||
@ -77,7 +77,7 @@ VALUES
|
|||||||
('Cisco','FireWall','');
|
('Cisco','FireWall','');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO Devices (location_fk, deviceTypes_fk, inventoryDate, deactivateDate, hostname, domain, description)
|
INSERT INTO Device (location_fk, deviceType_fk, inventoryDate, deactivateDate, hostname, domain, description)
|
||||||
VALUES
|
VALUES
|
||||||
(1,1,'2018-12-31','2019-12-31','CiscoR1','ch.zbw','Keller'),
|
(1,1,'2018-12-31','2019-12-31','CiscoR1','ch.zbw','Keller'),
|
||||||
(1,1,'2007-10-29','2008-10-29','CSTA003','ch.zbw','OG6'),
|
(1,1,'2007-10-29','2008-10-29','CSTA003','ch.zbw','OG6'),
|
||||||
@ -85,13 +85,28 @@ VALUES
|
|||||||
(3,1,'2018-06-06','2019-02-12','CiscoR006','ch.scs','Keller'),
|
(3,1,'2018-06-06','2019-02-12','CiscoR006','ch.scs','Keller'),
|
||||||
(1,1,'2018-02-01','2020-12-02','Cisco-PRT-032','ch.zbw','Kantine');
|
(1,1,'2018-02-01','2020-12-02','Cisco-PRT-032','ch.zbw','Kantine');
|
||||||
|
|
||||||
INSERT INTO Interfaces (interface_id, network_id_fk, devices_id_fk, ip_adress_v4, isFullDuplex, bandwith, description)
|
INSERT INTO Deviceport (description, device_fk, transportmedium_fk)
|
||||||
VALUES
|
VALUES
|
||||||
(1,3,1,'172.129.1.5',1,10000,''),
|
('GigabitEthernet 0/1', 1, 0),
|
||||||
(2,3,4,'172.129.1.6',1,10000,''),
|
('FastEtherne 0/1', 2, 1),
|
||||||
(3,1,5,'10.36.0.253',1,10000,''),
|
('FastEtherne 0/1', 2, 1),
|
||||||
(4,5,4,'192.168.128.192',1,10000,''),
|
('Etherne 0/1', 4, 2),
|
||||||
(5,3,3,'172.129.5.9',1,100,'');
|
('FastEtherne 0/1', 2, 1);
|
||||||
|
|
||||||
|
INSERT INTO Interface (interface_id, network_fk, device_fk, ip_adress_v4, mac_adresse, isFullDuplex, bandwith, is_in_use, description)
|
||||||
|
VALUES
|
||||||
|
(1,3,1,'172.129.1.5','0025:96FF:FE12:3456',1,10000,0,''),
|
||||||
|
(2,3,4,'172.129.1.6','0025:96FF:FE12:3457',1,10000,0,''),
|
||||||
|
(3,1,5,'10.36.0.253','0025:96FF:FE12:3458',1,10000,0,''),
|
||||||
|
(4,5,4,'192.168.128.192','0025:96FF:FE12:3459',1,10000,0,''),
|
||||||
|
(5,3,3,'172.129.5.9','0025:96FF:FE12:3455',1,100,0,'');
|
||||||
|
|
||||||
|
INSERT INTO Transportmedium (description)
|
||||||
|
VALUES
|
||||||
|
('LWL'),
|
||||||
|
('RJ45'),
|
||||||
|
('RJ11'),
|
||||||
|
('COM');
|
||||||
|
|
||||||
INSERT INTO operatingsystem (operatingsystem_id, operatingsystemName, model, version)
|
INSERT INTO operatingsystem (operatingsystem_id, operatingsystemName, model, version)
|
||||||
VALUES
|
VALUES
|
||||||
|
20
MySQL/View_Netzwerkinterface.sql
Normal file
20
MySQL/View_Netzwerkinterface.sql
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
CREATE VIEW
|
||||||
|
view_freiesInterface (LocationName, Hostname, Portnummer, Medium, Geschwindigkeit)
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
CONCAT_WS(building, room),
|
||||||
|
device.hostname,
|
||||||
|
deviceport.description,
|
||||||
|
transportmedium.description,
|
||||||
|
bandwith
|
||||||
|
FROM
|
||||||
|
device INNER JOIN location
|
||||||
|
ON location_fk=location_id
|
||||||
|
INNER JOIN deviceport
|
||||||
|
ON device_fk = device_id
|
||||||
|
INNER JOIN transportmedium
|
||||||
|
ON device_fk = device_id
|
||||||
|
INNER JOIN interface
|
||||||
|
ON interface.device_fk = device_id
|
||||||
|
WHERE interface.is_in_use = 0
|
||||||
|
;
|
BIN
MySQL/erm.mwb
BIN
MySQL/erm.mwb
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user