Merge branch 'main' into test
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
-- ops_system_metrics 增加账号切换次数统计(按分钟窗口)
|
||||
ALTER TABLE ops_system_metrics
|
||||
ADD COLUMN IF NOT EXISTS account_switch_count BIGINT NOT NULL DEFAULT 0;
|
||||
@@ -0,0 +1,13 @@
|
||||
-- 043_add_group_invalid_request_fallback.sql
|
||||
-- 添加无效请求兜底分组配置
|
||||
|
||||
-- 添加 fallback_group_id_on_invalid_request 字段:无效请求兜底使用的分组
|
||||
ALTER TABLE groups
|
||||
ADD COLUMN IF NOT EXISTS fallback_group_id_on_invalid_request BIGINT REFERENCES groups(id) ON DELETE SET NULL;
|
||||
|
||||
-- 添加索引优化查询
|
||||
CREATE INDEX IF NOT EXISTS idx_groups_fallback_group_id_on_invalid_request
|
||||
ON groups(fallback_group_id_on_invalid_request) WHERE deleted_at IS NULL AND fallback_group_id_on_invalid_request IS NOT NULL;
|
||||
|
||||
-- 添加字段注释
|
||||
COMMENT ON COLUMN groups.fallback_group_id_on_invalid_request IS '无效请求兜底使用的分组 ID';
|
||||
2
backend/migrations/044b_add_group_mcp_xml_inject.sql
Normal file
2
backend/migrations/044b_add_group_mcp_xml_inject.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
-- Add mcp_xml_inject field to groups table (for antigravity platform)
|
||||
ALTER TABLE groups ADD COLUMN mcp_xml_inject BOOLEAN NOT NULL DEFAULT true;
|
||||
20
backend/migrations/045_add_api_key_quota.sql
Normal file
20
backend/migrations/045_add_api_key_quota.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Migration: Add quota fields to api_keys table
|
||||
-- This migration adds independent quota and expiration support for API keys
|
||||
|
||||
-- Add quota limit field (0 = unlimited)
|
||||
ALTER TABLE api_keys ADD COLUMN IF NOT EXISTS quota DECIMAL(20, 8) NOT NULL DEFAULT 0;
|
||||
|
||||
-- Add used quota amount field
|
||||
ALTER TABLE api_keys ADD COLUMN IF NOT EXISTS quota_used DECIMAL(20, 8) NOT NULL DEFAULT 0;
|
||||
|
||||
-- Add expiration time field (NULL = never expires)
|
||||
ALTER TABLE api_keys ADD COLUMN IF NOT EXISTS expires_at TIMESTAMPTZ;
|
||||
|
||||
-- Add indexes for efficient quota queries
|
||||
CREATE INDEX IF NOT EXISTS idx_api_keys_quota_quota_used ON api_keys(quota, quota_used) WHERE deleted_at IS NULL;
|
||||
CREATE INDEX IF NOT EXISTS idx_api_keys_expires_at ON api_keys(expires_at) WHERE deleted_at IS NULL;
|
||||
|
||||
-- Comment on columns for documentation
|
||||
COMMENT ON COLUMN api_keys.quota IS 'Quota limit in USD for this API key (0 = unlimited)';
|
||||
COMMENT ON COLUMN api_keys.quota_used IS 'Used quota amount in USD';
|
||||
COMMENT ON COLUMN api_keys.expires_at IS 'Expiration time for this API key (null = never expires)';
|
||||
@@ -0,0 +1,6 @@
|
||||
-- 添加分组支持的模型系列字段
|
||||
ALTER TABLE groups
|
||||
ADD COLUMN IF NOT EXISTS supported_model_scopes JSONB NOT NULL
|
||||
DEFAULT '["claude", "gemini_text", "gemini_image"]'::jsonb;
|
||||
|
||||
COMMENT ON COLUMN groups.supported_model_scopes IS '支持的模型系列:claude, gemini_text, gemini_image';
|
||||
Reference in New Issue
Block a user