summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2022-02-25 09:04:16 +0200
committerGitHub <noreply@github.com>2022-02-25 09:04:16 +0200
commit44c6382e2b9bc92e9a0cbfb56d6994e28bd1d7a2 (patch)
treea9cf6a87393e6f843217d621c1852175fb62f046 /database
parent4a8f6bcabd67c0ef7cb368c915d12a932909383b (diff)
Add a fix to correctly register child nodes to the cloud via a parent (#12241)
* Add a trigger to populate the node_instance table. This will allow older agent versions pre v1.31 to connect to the cloud via the parent * Minor fix : Make the trigger creation a separate statement
Diffstat (limited to 'database')
-rw-r--r--database/sqlite/sqlite_functions.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/database/sqlite/sqlite_functions.c b/database/sqlite/sqlite_functions.c
index 2019a6858a..f1585b661b 100644
--- a/database/sqlite/sqlite_functions.c
+++ b/database/sqlite/sqlite_functions.c
@@ -40,6 +40,9 @@ const char *database_config[] = {
"CREATE VIEW IF NOT EXISTS v_chart_hash as SELECT ch.*, chm.chart_id FROM chart_hash ch, chart_hash_map chm "
"WHERE ch.hash_id = chm.hash_id;",
+ "CREATE TRIGGER IF NOT EXISTS ins_host AFTER INSERT ON host BEGIN INSERT INTO node_instance (host_id, date_created)"
+ " SELECT new.host_id, strftime(\"%s\") WHERE new.host_id NOT IN (SELECT host_id FROM node_instance); END;",
+
"CREATE TRIGGER IF NOT EXISTS tr_v_chart_hash INSTEAD OF INSERT on v_chart_hash BEGIN "
"INSERT INTO chart_hash (hash_id, type, id, name, family, context, title, unit, plugin, "
"module, priority, chart_type, last_used) "