refactor(store): consolidate unreleased database migrations

Merge error details and account affinity settings into migration 0023. Preserve all migrations shipped in v3.20.0 and validate upgrades from its 0022 baseline.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-10-07 02:49:01 +08:00
co-authored by Codex
parent 0bfeff28fc
commit 693025afa4
6 changed files with 13 additions and 15 deletions
@@ -1185,7 +1185,7 @@ async fn warmup_cursor_resolves_dst_and_deduplicates_across_timezones() {
async fn account_affinity_upgrade_defaults_and_updates_reach_the_snapshot() {
use gateway_core::account::AccountAffinity;
use gateway_store::postgres::{PgRuntimeSnapshotRepository, RuntimeSnapshotRepository};
let Some(database) = TestDatabase::create_through("account_affinity_upgrade", 23).await else {
let Some(database) = TestDatabase::create_through("account_affinity_upgrade", 22).await else {
return;
};
sqlx::query("update runtime_settings set rotation_strategy = 'sticky' where id = 1")
+1 -3
View File
@@ -20,6 +20,4 @@ fcfae912ddefd54551ebf8e7e733442519d2862d2977134d548ebc1e75c1dc34 0017_unlimited
e8c1339166ac02fb2d4a077424ee5f64f6dc20eb4d3f8ec4fcb09c0f2a0e61f6 0020_plugin_trust.sql
22faf2646168275150b1786c0f463f9ff2ca52463a272479e4fcc6f46c8cfa37 0021_runtime_scheduling.sql
77a140ddfb9dfae9b7d7349e5bfc9c8a7e7927bae6e77c1a627b34fcbb714bdb 0022_refresh_margin_and_group_fast_mode.sql
68fe28522870903f9a9c9772e13edda29b9b0f1798d350b1025c273b05d25370 0023_error_details.sql
11cb65ee4858c532360d37fa161ffa3e7dad44e81791c24b949154485d255804 0024_account_affinity.sql
e71acda93c9a315bff7bb95a599cabac029c627d5d1b6f4488547f568ad22415 0025_session_affinity_ttl.sql
d431ebf24669451da06bb6671136bf58cddcc713b43a1a705eb33f9cb4f9b577 0023_error_details_and_account_affinity.sql
@@ -1,3 +0,0 @@
-- 运维错误详情同时承载本地来源链与上游响应,运行时只使用统一字段
alter table model_requests rename column raw_upstream_error to error_details;
alter table ops_events rename column raw_upstream_error to error_details;
@@ -0,0 +1,11 @@
-- 运维错误详情同时承载本地来源链与上游响应,运行时只使用统一字段
alter table model_requests rename column raw_upstream_error to error_details;
alter table ops_events rename column raw_upstream_error to error_details;
alter table runtime_settings
add column openai_account_affinity text not null default 'relaxed'
check (openai_account_affinity in ('relaxed', 'strict')),
add column max_account_rotations bigint not null default 3
check (max_account_rotations between 0 and 31),
add column openai_session_affinity_ttl_hours bigint not null default 24
check (openai_session_affinity_ttl_hours between 1 and 720);
@@ -1,5 +0,0 @@
alter table runtime_settings
add column openai_account_affinity text not null default 'relaxed'
check (openai_account_affinity in ('relaxed', 'strict')),
add column max_account_rotations bigint not null default 3
check (max_account_rotations between 0 and 31);
@@ -1,3 +0,0 @@
alter table runtime_settings
add column openai_session_affinity_ttl_hours bigint not null default 24
check (openai_session_affinity_ttl_hours between 1 and 720);