From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001
From: Martial Simon <msimon_fr@hotmail.com>
Date: Mon, 15 Sep 2025 01:08:27 +0200
Subject: add: graphs et rushs

---
 graphs/sql/maas/req05_view.sql | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 graphs/sql/maas/req05_view.sql

(limited to 'graphs/sql/maas/req05_view.sql')

diff --git a/graphs/sql/maas/req05_view.sql b/graphs/sql/maas/req05_view.sql
new file mode 100644
index 0000000..b6e792f
--- /dev/null
+++ b/graphs/sql/maas/req05_view.sql
@@ -0,0 +1,22 @@
+CREATE RECURSIVE VIEW memorin.server_hierarchy (id,zone_id,core_count,ram,storage,data_center_id) AS (
+    SELECT
+        id,
+        zone_id,
+        core_count,
+        ram,
+        storage,
+        id AS data_center_id
+    FROM memorin.servers
+    WHERE master_id IS NULL
+    UNION ALL
+    SELECT
+        servers.id,
+        servers.zone_id,
+        servers.core_count,
+        servers.ram,
+        servers.storage,
+        sh.data_center_id
+    FROM memorin.servers
+    INNER JOIN server_hierarchy AS sh
+    ON sh.id = servers.master_id
+);
-- 
cgit v1.2.3

