네트워크 이력 DB 저장 전환

This commit is contained in:
seo
2026-07-25 22:28:58 +09:00
parent bc89dcf9c0
commit 30c0cb4663
4 changed files with 187 additions and 74 deletions
+25
View File
@@ -589,6 +589,31 @@ function bootstrap_db(): void
COLLATE=utf8mb4_unicode_ci
");
$pdo->exec("
CREATE TABLE IF NOT EXISTS network_usage_logs (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
recorded_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
iface VARCHAR(32) NOT NULL,
rx_bytes BIGINT UNSIGNED NOT NULL,
tx_bytes BIGINT UNSIGNED NOT NULL,
rx_packets BIGINT UNSIGNED NOT NULL,
tx_packets BIGINT UNSIGNED NOT NULL,
rx_mbps DECIMAL(12,4) NULL,
tx_mbps DECIMAL(12,4) NULL,
rx_pps DECIMAL(12,2) NULL,
tx_pps DECIMAL(12,2) NULL,
create_ip VARCHAR(64) NULL,
INDEX idx_recorded_at (recorded_at),
INDEX idx_iface_recorded_at (iface, recorded_at)
) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci
");
$pdo->exec("
CREATE TABLE IF NOT EXISTS remember_tokens (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,