sub2api/backend/migrations/082_create_gateway_debug_logs.sql
win d3d885cf75
Some checks failed
CI / test (push) Failing after 6s
CI / golangci-lint (push) Failing after 5s
Security Scan / backend-security (push) Failing after 5s
Security Scan / frontend-security (push) Failing after 7s
fix: node-tls-proxy not receiving traffic due to viper BindEnv bug
- Add explicit viper.BindEnv() for all gateway.node_tls_proxy.* keys
  to fix viper's AutomaticEnv+Unmarshal nested struct bug where env vars
  are silently ignored when config.yaml lacks the corresponding section
- Sync proxy.js CLI_VERSION 2.1.84→2.1.87 and BUILD_TIME to match
  constants.go, eliminating API/telemetry version mismatch
2026-03-31 13:16:02 +08:00

38 lines
1.1 KiB
SQL

CREATE TABLE IF NOT EXISTS gateway_debug_logs (
id BIGSERIAL PRIMARY KEY,
upstream_request_id TEXT,
account_id BIGINT,
account_email TEXT,
account_platform TEXT,
event_type TEXT NOT NULL DEFAULT 'api_call',
method TEXT,
full_url TEXT,
request_headers TEXT,
request_body TEXT,
request_size INTEGER,
response_status INTEGER,
response_headers TEXT,
response_body_preview TEXT,
response_size INTEGER,
model_requested TEXT,
model_upstream TEXT,
is_stream BOOLEAN DEFAULT FALSE,
duration_ms INTEGER,
tls_profile TEXT,
error_message TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_gdl_account_id ON gateway_debug_logs (account_id);
CREATE INDEX IF NOT EXISTS idx_gdl_created_at ON gateway_debug_logs (created_at);
CREATE INDEX IF NOT EXISTS idx_gdl_event_type ON gateway_debug_logs (event_type);
CREATE INDEX IF NOT EXISTS idx_gdl_model ON gateway_debug_logs (model_requested);