collect power metrics
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `power_metrics` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`node_id` BIGINT NOT NULL,
|
||||
`packet_id` BIGINT NULL,
|
||||
`ch1_voltage` DECIMAL(65, 30) NULL,
|
||||
`ch1_current` DECIMAL(65, 30) NULL,
|
||||
`ch2_voltage` DECIMAL(65, 30) NULL,
|
||||
`ch2_current` DECIMAL(65, 30) NULL,
|
||||
`ch3_voltage` DECIMAL(65, 30) NULL,
|
||||
`ch3_current` 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 `power_metrics_created_at_idx`(`created_at`),
|
||||
INDEX `power_metrics_updated_at_idx`(`updated_at`),
|
||||
INDEX `power_metrics_node_id_idx`(`node_id`),
|
||||
INDEX `power_metrics_packet_id_idx`(`packet_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
@ -139,6 +139,28 @@ model EnvironmentMetric {
|
||||
@@map("environment_metrics")
|
||||
}
|
||||
|
||||
model PowerMetric {
|
||||
id BigInt @id @default(autoincrement())
|
||||
node_id BigInt
|
||||
packet_id BigInt?
|
||||
|
||||
ch1_voltage Decimal?
|
||||
ch1_current Decimal?
|
||||
ch2_voltage Decimal?
|
||||
ch2_current Decimal?
|
||||
ch3_voltage Decimal?
|
||||
ch3_current Decimal?
|
||||
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @default(now()) @updatedAt
|
||||
|
||||
@@index(created_at)
|
||||
@@index(updated_at)
|
||||
@@index(node_id)
|
||||
@@index(packet_id)
|
||||
@@map("power_metrics")
|
||||
}
|
||||
|
||||
model Position {
|
||||
id BigInt @id @default(autoincrement())
|
||||
node_id BigInt
|
||||
|
Reference in New Issue
Block a user