feat(账号): 添加 Sora 账号双表同步与创建
- 新增 sora_accounts 表与 accounts.extra GIN 索引\n- OpenAI OAuth 支持同时创建 Sora 账号并同步配置\n- Token 刷新同步关联 Sora 账号凭证与扩展表\n- 增加 Sora 账号连通性测试与前端开关文案
This commit is contained in:
13
backend/migrations/045_add_accounts_extra_index.sql
Normal file
13
backend/migrations/045_add_accounts_extra_index.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- Migration: 045_add_accounts_extra_index
|
||||
-- 为 accounts.extra 字段添加 GIN 索引,优化 FindByExtraField 查询性能
|
||||
-- 用于支持通过 extra 字段中的 linked_openai_account_id 快速查找关联的 Sora 账号
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_accounts_extra_gin
|
||||
ON accounts USING GIN (extra);
|
||||
|
||||
-- 查询示例(使用 @> 操作符)
|
||||
-- EXPLAIN ANALYZE
|
||||
-- SELECT * FROM accounts
|
||||
-- WHERE platform = 'sora'
|
||||
-- AND extra @> '{"linked_openai_account_id": 123}'::jsonb
|
||||
-- AND deleted_at IS NULL;
|
||||
Reference in New Issue
Block a user