Files
tokens-reef/backend/migrations/048_add_error_passthrough_rules.sql
Developer da36506b89 fix: resolve P0/P1 code quality issues
P0 fixes:
- ModelError.Is(): use exact matching instead of substring contains()
- shouldClearStickySession: add context param for cancellation/tracing

P1 fixes:
- TODO stubs: return 501 Not Implemented errors
- validateInstanceSignature: deduplicate to shared validateCodeSignature()
- Error messages: standardize to English only
- http.go: remove pseudo if-else with duplicate branches
2026-03-31 11:39:18 +08:00

25 lines
995 B
SQL

-- Error Passthrough Rules table
-- Allows administrators to configure how upstream errors are passed through to clients
CREATE TABLE IF NOT EXISTS error_passthrough_rules (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
enabled BOOLEAN NOT NULL DEFAULT true,
priority INTEGER NOT NULL DEFAULT 0,
error_codes JSONB DEFAULT '[]',
keywords JSONB DEFAULT '[]',
match_mode VARCHAR(10) NOT NULL DEFAULT 'any',
platforms JSONB DEFAULT '[]',
passthrough_code BOOLEAN NOT NULL DEFAULT true,
response_code INTEGER,
passthrough_body BOOLEAN NOT NULL DEFAULT true,
custom_message TEXT,
description TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Indexes for efficient queries
CREATE INDEX IF NOT EXISTS idx_error_passthrough_rules_enabled ON error_passthrough_rules (enabled);
CREATE INDEX IF NOT EXISTS idx_error_passthrough_rules_priority ON error_passthrough_rules (priority);