From 9f84c47b69e88d1be697202d34386bbaf460accf Mon Sep 17 00:00:00 2001
From: Patrick Keist
Date: Sat, 8 Jun 2019 12:15:19 +0200
Subject: [PATCH] Changed Table Location for Parent-Child-Relation (Tree)
Testat 3 needs this.
---
MySQL/Skript_DDL.sql | 1 +
MySQL/Skript_DML.sql | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/MySQL/Skript_DDL.sql b/MySQL/Skript_DDL.sql
index 27ba977..a2d3b2b 100644
--- a/MySQL/Skript_DDL.sql
+++ b/MySQL/Skript_DDL.sql
@@ -42,6 +42,7 @@ FOREIGN KEY (kundenkonto_fk) REFERENCES Kundenkonto(kundenkonto_id) ON DELETE CA
CREATE TABLE IF NOT EXISTS Location (
location_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+parent_location INT UNSIGNED,
address_fk INT UNSIGNED NOT NULL,
designation VARCHAR(45) NOT NULL,
building INT UNSIGNED NOT NULL,
diff --git a/MySQL/Skript_DML.sql b/MySQL/Skript_DML.sql
index 59c8d8e..6ee101c 100644
--- a/MySQL/Skript_DML.sql
+++ b/MySQL/Skript_DML.sql
@@ -47,11 +47,12 @@ VALUES
(4,2),
(5,1);
-INSERT INTO location( address_fk, designation, building, room)
+INSERT INTO location( parent_location, address_fk, designation, building, room)
VALUES
-(1, 'Vertriebszentrum Tabak', 2, 4),
-(2, 'Absteige',5,9),
-(3, 'Consult & Pepper', 6,9);
+(null, 1, 'Vertriebszentrum Tabak', 2, 4),
+(1, 1, 'Logistik', 2, 5),
+(1, 2, 'Administration',1,9),
+(1, 2, 'Buchhaltung', 1,8);
INSERT INTO pointofdelivery(customer_person_fk, contact_person_fk, location_fk, designation, timezone, timeZonePositiv, ntpServerIp)
@@ -144,7 +145,11 @@ INSERT INTO v_logentries(pod, location, hostname, severity, `timestamp`, message
VALUES
("test1", "St. Gallen", "schokoladenweg", 5, now(), "Das ist eine aufwändige Aufgabe"),
("test2", "Appenzell", "Fählensee", 3, now(), "Gruss aus dem Alpstein"),
-("test3", "Abtwil", "Zbw", 3, now(), "Keine Lust mehr auf Schulabende..");
+("test3", "Abtwil", "Zbw", 3, now(), "Keine Lust mehr auf Schulabende.."),
+("test4", "St. Gallen", "Zbw", 3, now(), "Hallo Gerät"),
+("test5", "Abtwil", "Zbw", 3, now(), "Hallo User"),
+("test6", "St. Gallen", "Zbw", 3, now(), "Hallo Welt"),
+("test7", "St. Gallen", "Zbw", 3, now(), "Hallo Gerät");
INSERT INTO Interface (interface_id, network_fk, device_fk, ip_adress_v4, mac_adresse, isFullDuplex, bandwith, is_in_use, description)
VALUES