refactor: Update all applications to store metrics (#7853)

* Update all applications to store metrics

* fix db schema

* Add glue test
This commit is contained in:
Tony Murray
2017-12-06 22:13:10 +00:00
committed by Neil Lathwood
co-authored by Neil Lathwood
parent 0dd3ec25d3
commit b620692426
44 changed files with 181 additions and 74 deletions
+7 -3
View File
@@ -1372,12 +1372,16 @@ function ResolveGlues($tables, $target, $x = 0, $hist = array(), $last = array()
foreach ($tables as $table) {
if ($table == 'state_translations' && ($target == 'device_id' || $target == 'sensor_id')) {
// workaround for state_translations
$st_tables = array(
return array_merge($last, array(
'state_translations.state_index_id',
'sensors_to_state_indexes.sensor_id',
"sensors.$target",
);
return array_merge($last, $st_tables);
));
} elseif ($table == 'application_metrics' && $target = 'device_id') {
return array_merge($last, array(
'application_metrics.app_id',
"applications.$target",
));
}
$glues = dbFetchRows('SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME LIKE "%\_id"', array($table));