mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-19 16:17:56 +00:00
Add the group Fast migration
This commit is contained in:
@@ -55,8 +55,9 @@ func TestMigrationsRunner_IsIdempotent_AndSchemaIsUpToDate(t *testing.T) {
|
||||
requireColumn(t, tx, "accounts", "session_window_status", "character varying", 20, true)
|
||||
requireIndex(t, tx, "accounts", "idx_accounts_autopause_expiry_due")
|
||||
|
||||
// groups: OpenAI Live 默认关闭,管理员显式开启后才可访问。
|
||||
// groups: OpenAI Live 与 Fast 强制策略都默认关闭,管理员显式开启后才生效。
|
||||
requireColumn(t, tx, "groups", "allow_live", "boolean", 0, false)
|
||||
requireColumn(t, tx, "groups", "force_openai_fast", "boolean", 0, false)
|
||||
|
||||
// api_keys: key length should be 128
|
||||
requireColumn(t, tx, "api_keys", "key", "character varying", 128, false)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE groups
|
||||
ADD COLUMN IF NOT EXISTS force_openai_fast BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
COMMENT ON COLUMN groups.force_openai_fast IS
|
||||
'Force OpenAI gateway requests in this group to use service_tier=priority before global Fast/Flex policy evaluation';
|
||||
@@ -0,0 +1,18 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGroupForceOpenAIFastMigration(t *testing.T) {
|
||||
content, err := FS.ReadFile("232_group_force_openai_fast.sql")
|
||||
require.NoError(t, err)
|
||||
|
||||
sql := strings.Join(strings.Fields(string(content)), " ")
|
||||
require.Contains(t, sql,
|
||||
"ADD COLUMN IF NOT EXISTS force_openai_fast BOOLEAN NOT NULL DEFAULT FALSE")
|
||||
require.Contains(t, sql, "COMMENT ON COLUMN groups.force_openai_fast")
|
||||
}
|
||||
Reference in New Issue
Block a user