collect device metrics

This commit is contained in:
liamcottle
2024-03-14 00:55:27 +13:00
parent 7f1bc47b87
commit b812d730dc
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,16 @@
-- CreateTable
CREATE TABLE `device_metrics` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`node_id` BIGINT NOT NULL,
`battery_level` INTEGER NULL,
`voltage` DECIMAL(65, 30) NULL,
`channel_utilization` DECIMAL(65, 30) NULL,
`air_util_tx` DECIMAL(65, 30) NULL,
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
INDEX `device_metrics_created_at_idx`(`created_at`),
INDEX `device_metrics_updated_at_idx`(`updated_at`),
INDEX `device_metrics_node_id_idx`(`node_id`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;