-- Generated by aether-data-schema from schema/logical/*.toml. -- Do not edit generated files directly; edit logical schema or explicit overrides instead. CREATE TABLE IF NOT EXISTS proxy_nodes ( `id` VARCHAR(64) NOT NULL, `name` VARCHAR(255) NOT NULL, `ip` VARCHAR(512) NOT NULL, `port` INT NOT NULL, `region` VARCHAR(100), `status` VARCHAR(32) NOT NULL DEFAULT 'online', `registered_by` VARCHAR(64), `last_heartbeat_at` BIGINT, `heartbeat_interval` INT NOT NULL DEFAULT 30, `active_connections` INT NOT NULL DEFAULT 0, `total_requests` BIGINT NOT NULL DEFAULT 0, `avg_latency_ms` DOUBLE, `is_manual` TINYINT(1) NOT NULL DEFAULT 0, `proxy_url` VARCHAR(500), `proxy_username` VARCHAR(255), `proxy_password` VARCHAR(500), `created_at` BIGINT NOT NULL, `updated_at` BIGINT NOT NULL, `remote_config` JSON, `config_version` INT NOT NULL DEFAULT 0, `hardware_info` JSON, `estimated_max_concurrency` INT, `tunnel_mode` TINYINT(1) NOT NULL DEFAULT 0, `tunnel_connected` TINYINT(1) NOT NULL DEFAULT 0, `tunnel_connected_at` BIGINT, `failed_requests` BIGINT NOT NULL DEFAULT 0, `dns_failures` BIGINT NOT NULL DEFAULT 0, `stream_errors` BIGINT NOT NULL DEFAULT 0, `proxy_metadata` JSON, PRIMARY KEY (`id`) ); CREATE TABLE IF NOT EXISTS proxy_node_events ( `id` BIGINT NOT NULL AUTO_INCREMENT, `node_id` VARCHAR(64) NOT NULL, `event_type` VARCHAR(64) NOT NULL, `detail` VARCHAR(500), `event_metadata` JSON, `created_at` BIGINT NOT NULL, PRIMARY KEY (`id`) ); CREATE TABLE IF NOT EXISTS proxy_node_metrics_1m ( `node_id` VARCHAR(64) NOT NULL, `bucket_start_unix_secs` BIGINT NOT NULL, `samples` BIGINT NOT NULL DEFAULT 0, `uptime_samples` BIGINT NOT NULL DEFAULT 0, `active_connections_sum` BIGINT NOT NULL DEFAULT 0, `active_connections_max` BIGINT NOT NULL DEFAULT 0, `heartbeat_rtt_ms_sum` BIGINT NOT NULL DEFAULT 0, `heartbeat_rtt_ms_max` BIGINT NOT NULL DEFAULT 0, `connect_errors_delta` BIGINT NOT NULL DEFAULT 0, `disconnects_delta` BIGINT NOT NULL DEFAULT 0, `error_events_delta` BIGINT NOT NULL DEFAULT 0, `ws_in_bytes_delta` BIGINT NOT NULL DEFAULT 0, `ws_out_bytes_delta` BIGINT NOT NULL DEFAULT 0, `ws_in_frames_delta` BIGINT NOT NULL DEFAULT 0, `ws_out_frames_delta` BIGINT NOT NULL DEFAULT 0, PRIMARY KEY (`node_id`, `bucket_start_unix_secs`), KEY idx_proxy_node_metrics_1m_bucket_start (`bucket_start_unix_secs`) ); CREATE TABLE IF NOT EXISTS proxy_node_metrics_1h ( `node_id` VARCHAR(64) NOT NULL, `bucket_start_unix_secs` BIGINT NOT NULL, `samples` BIGINT NOT NULL DEFAULT 0, `uptime_samples` BIGINT NOT NULL DEFAULT 0, `active_connections_sum` BIGINT NOT NULL DEFAULT 0, `active_connections_max` BIGINT NOT NULL DEFAULT 0, `heartbeat_rtt_ms_sum` BIGINT NOT NULL DEFAULT 0, `heartbeat_rtt_ms_max` BIGINT NOT NULL DEFAULT 0, `connect_errors_delta` BIGINT NOT NULL DEFAULT 0, `disconnects_delta` BIGINT NOT NULL DEFAULT 0, `error_events_delta` BIGINT NOT NULL DEFAULT 0, `ws_in_bytes_delta` BIGINT NOT NULL DEFAULT 0, `ws_out_bytes_delta` BIGINT NOT NULL DEFAULT 0, `ws_in_frames_delta` BIGINT NOT NULL DEFAULT 0, `ws_out_frames_delta` BIGINT NOT NULL DEFAULT 0, PRIMARY KEY (`node_id`, `bucket_start_unix_secs`), KEY idx_proxy_node_metrics_1h_bucket_start (`bucket_start_unix_secs`) );