Tabellen für Netzwerk und Abfragen erstellt und angepasst
Tabellen Medium und Port hinzugefügt diverse unbenennungen an Tabellen vorgenommen. Tabelle Interface MAC-Adresse Column hinzugefügt
This commit is contained in:
parent
55cb8e1ecc
commit
b5795ecaa6
@ -1,5 +1,3 @@
|
|||||||
-- Test von ronny
|
|
||||||
|
|
||||||
DROP DATABASE IF EXISTS inventarisierungsloesung;
|
DROP DATABASE IF EXISTS inventarisierungsloesung;
|
||||||
|
|
||||||
CREATE DATABASE IF NOT EXISTS Inventarisierungsloesung
|
CREATE DATABASE IF NOT EXISTS Inventarisierungsloesung
|
||||||
@ -58,7 +56,6 @@ priority ENUM('First Priority','Second Priority','Emergency Contact') NOT NULL,
|
|||||||
FOREIGN KEY (person_fk) REFERENCES Person(person_id)ON DELETE CASCADE
|
FOREIGN KEY (person_fk) REFERENCES Person(person_id)ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS PointOfDelivery (
|
CREATE TABLE IF NOT EXISTS PointOfDelivery (
|
||||||
pod_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
pod_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
customer_person_fk INT UNSIGNED NOT NULL,
|
customer_person_fk INT UNSIGNED NOT NULL,
|
||||||
@ -73,25 +70,25 @@ FOREIGN KEY (`contact_person_fk`) REFERENCES `contact`(`contact_id`)ON DELETE CA
|
|||||||
FOREIGN KEY (`location_fk`) REFERENCES `location`(`location_id`) ON DELETE CASCADE
|
FOREIGN KEY (`location_fk`) REFERENCES `location`(`location_id`) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE Table IF NOT EXISTS DevicesTypes (
|
CREATE TABLE IF NOT EXISTS DeviceType (
|
||||||
deviceTypes_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
deviceType_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
manifacture VARCHAR(255) NOT NULL,
|
manifacturer VARCHAR(255) NOT NULL,
|
||||||
model VARCHAR(255) NOT NULL,
|
model VARCHAR(255) NOT NULL,
|
||||||
version VARCHAR(255) NOT NULL,
|
version VARCHAR(255) NULL,
|
||||||
PRIMARY KEY(deviceTypes_id)
|
PRIMARY KEY (deviceType_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE Table IF NOT EXISTS Devices (
|
CREATE Table IF NOT EXISTS Device (
|
||||||
device_id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
device_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
location_fk INT UNSIGNED NOT NULL,
|
location_fk INT UNSIGNED NOT NULL,
|
||||||
deviceTypes_fk INT UNSIGNED NOT NULL,
|
deviceType_fk INT UNSIGNED NOT NULL,
|
||||||
inventoryDate DATE NOT NULL,
|
inventoryDate DATE NOT NULL,
|
||||||
deactivateDate DATE NOT NULL,
|
deactivateDate DATE NOT NULL,
|
||||||
hostname VARCHAR(255),
|
hostname VARCHAR(255),
|
||||||
domain VARCHAR(255),
|
domain VARCHAR(255),
|
||||||
description VARCHAR(255),
|
description VARCHAR(255),
|
||||||
FOREIGN KEY (location_fk) REFERENCES Location(location_id) ON DELETE CASCADE,
|
FOREIGN KEY (location_fk) REFERENCES location (location_id) ON DELETE CASCADE,
|
||||||
FOREIGN KEY (deviceTypes_fk) REFERENCES DevicesTypes(deviceTypes_id) ON DELETE CASCADE
|
FOREIGN KEY (deviceType_fk) REFERENCES devicetype (deviceType_id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE Table IF NOT EXISTS Operatingsystem (
|
CREATE Table IF NOT EXISTS Operatingsystem (
|
||||||
@ -101,40 +98,60 @@ model VARCHAR(255) NOT NULL,
|
|||||||
version VARCHAR(255)
|
version VARCHAR(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE Table IF NOT EXISTS DevicesTypes_has_operatingsystem (
|
CREATE Table IF NOT EXISTS DeviceType_has_operatingsystem (
|
||||||
deviceTypes_fk INT UNSIGNED NOT NULL,
|
deviceType_fk INT UNSIGNED NOT NULL,
|
||||||
operatingsystem_fk INT UNSIGNED NOT NULL,
|
operatingsystem_fk INT UNSIGNED NOT NULL,
|
||||||
PRIMARY KEY(deviceTypes_fk,operatingsystem_fk),
|
PRIMARY KEY(deviceType_fk,operatingsystem_fk),
|
||||||
FOREIGN KEY (deviceTypes_fk) REFERENCES DevicesTypes(deviceTypes_id) ON DELETE CASCADE,
|
FOREIGN KEY (deviceType_fk) REFERENCES DeviceType (deviceType_id) ON DELETE CASCADE,
|
||||||
FOREIGN KEY (operatingsystem_fk) REFERENCES Operatingsystem (operatingsystem_id) ON DELETE CASCADE
|
FOREIGN KEY (operatingsystem_fk) REFERENCES Operatingsystem (operatingsystem_id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS Network (
|
||||||
|
network_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
subnet VARCHAR(15) NOT NULL,
|
||||||
|
mask VARCHAR(15) NOT NULL,
|
||||||
|
vlan INT NOT NULL DEFAULT 1,
|
||||||
|
description VARCHAR(255) NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS Interface (
|
||||||
|
interface_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
network_fk INT NOT NULL,
|
||||||
|
device_fk INT UNSIGNED NOT NULL,
|
||||||
|
ip_adress_v4 VARCHAR(15) NOT NULL,
|
||||||
|
mac_adresse VARCHAR(17) NOT NULL,
|
||||||
|
isFullDuplex BIT(1) NOT NULL DEFAULT 1,
|
||||||
|
bandwith INT NULL,
|
||||||
|
description VARCHAR(255) NULL,
|
||||||
|
FOREIGN KEY (network_fk) REFERENCES Network (network_id)ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS Medium (
|
||||||
|
medium_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
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 (
|
||||||
|
port_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
description VARCHAR(45) NOT NULL,
|
||||||
|
device_fk INT UNSIGNED NOT NULL,
|
||||||
|
medium_fk INT UNSIGNED NOT NULL,
|
||||||
|
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (Medium_fk) REFERENCES Medium (medium_id)ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
CREATE Table IF NOT EXISTS Log (
|
CREATE Table IF NOT EXISTS Log (
|
||||||
log_id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
log_id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||||
device_fk INT UNSIGNED NOT NULL,
|
device_fk INT UNSIGNED NOT NULL,
|
||||||
timestamp DATETIME NOT NULL,
|
timestamp DATETIME NOT NULL,
|
||||||
logMessage VARCHAR(255) NOT NULL,
|
logMessage VARCHAR(255) NOT NULL,
|
||||||
level ENUM('Low','Middle','High') NOT NULL,
|
level ENUM('Low','Middle','High') NOT NULL,
|
||||||
FOREIGN KEY (device_fk) REFERENCES Devices(device_id) ON DELETE CASCADE
|
FOREIGN KEY (device_fk) REFERENCES Device(device_id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Network (
|
|
||||||
network_id INT NOT NULL AUTO_INCREMENT,
|
|
||||||
subnet VARCHAR(15) NOT NULL,
|
|
||||||
mask VARCHAR(15) NOT NULL,
|
|
||||||
vlan INT NOT NULL DEFAULT 1,
|
|
||||||
description VARCHAR(255) NULL,
|
|
||||||
PRIMARY KEY (network_id));
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DeviceTypes (
|
|
||||||
deviceTypes_id INT NOT NULL AUTO_INCREMENT,
|
|
||||||
manifacturer VARCHAR(255) NOT NULL,
|
|
||||||
model VARCHAR(255) NOT NULL,
|
|
||||||
version VARCHAR(255) NULL,
|
|
||||||
PRIMARY KEY (deviceTypes_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Credentials (
|
CREATE TABLE IF NOT EXISTS Credentials (
|
||||||
credentials_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
credentials_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
benutzername VARCHAR(255) NOT NULL,
|
benutzername VARCHAR(255) NOT NULL,
|
||||||
@ -143,19 +160,6 @@ CREATE TABLE IF NOT EXISTS Credentials (
|
|||||||
PRIMARY KEY (credentials_id)
|
PRIMARY KEY (credentials_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Interfaces (
|
|
||||||
interface_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
||||||
network_id_fk INT NOT NULL,
|
|
||||||
devices_id_fk INT UNSIGNED NOT NULL,
|
|
||||||
ip_adress_v4 VARCHAR(15) NOT NULL,
|
|
||||||
isFullDuplex BIT(1) NOT NULL DEFAULT 1,
|
|
||||||
bandwith INT NULL,
|
|
||||||
description VARCHAR(255) NULL,
|
|
||||||
PRIMARY KEY (interface_id),
|
|
||||||
FOREIGN KEY (network_id_fk) REFERENCES Network (network_id)ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY (devices_id_fk) REFERENCES Devices (device_id)ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Abrechnung (
|
CREATE TABLE IF NOT EXISTS Abrechnung (
|
||||||
abrechnung_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
abrechnung_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
kundenkonto_fk INT UNSIGNED NOT NULL,
|
kundenkonto_fk INT UNSIGNED NOT NULL,
|
||||||
@ -165,8 +169,8 @@ CREATE TABLE IF NOT EXISTS Interfaces (
|
|||||||
PRIMARY KEY (abrechnung_id),
|
PRIMARY KEY (abrechnung_id),
|
||||||
FOREIGN KEY (kundenkonto_fk) REFERENCES Kundenkonto (kundenkonto_id)ON DELETE CASCADE,
|
FOREIGN KEY (kundenkonto_fk) REFERENCES Kundenkonto (kundenkonto_id)ON DELETE CASCADE,
|
||||||
FOREIGN KEY (location_fk) REFERENCES Location (location_id)ON DELETE CASCADE,
|
FOREIGN KEY (location_fk) REFERENCES Location (location_id)ON DELETE CASCADE,
|
||||||
FOREIGN KEY (device_fk) REFERENCES Devices (device_id)ON DELETE CASCADE,
|
FOREIGN KEY (device_fk) REFERENCES Device (device_id)ON DELETE CASCADE,
|
||||||
FOREIGN KEY (interface_fk) REFERENCES Interfaces (interface_id)ON DELETE CASCADE
|
FOREIGN KEY (interface_fk) REFERENCES Interface (interface_id)ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS SoftwareDienstleistung (
|
CREATE TABLE IF NOT EXISTS SoftwareDienstleistung (
|
||||||
@ -199,6 +203,6 @@ CREATE TABLE IF NOT EXISTS Produkte (
|
|||||||
devices_devices_id INT UNSIGNED NOT NULL,
|
devices_devices_id INT UNSIGNED NOT NULL,
|
||||||
credentials_credentials_id INT UNSIGNED NOT NULL,
|
credentials_credentials_id INT UNSIGNED NOT NULL,
|
||||||
PRIMARY KEY (devices_devices_id, credentials_credentials_id),
|
PRIMARY KEY (devices_devices_id, credentials_credentials_id),
|
||||||
FOREIGN KEY (devices_devices_id) REFERENCES Devices (device_id) ON DELETE CASCADE,
|
FOREIGN KEY (devices_devices_id) REFERENCES Device (device_id) ON DELETE CASCADE,
|
||||||
FOREIGN KEY (credentials_credentials_id) REFERENCES Credentials (credentials_id) ON DELETE CASCADE
|
FOREIGN KEY (credentials_credentials_id) REFERENCES Credentials (credentials_id) ON DELETE CASCADE
|
||||||
);
|
);
|
Loading…
Reference in New Issue
Block a user