chore(db): consolidate unreleased proxy and privacy migration

Keep published migrations unchanged and apply proxy enablement and privacy rule conversion in one migration.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-10-15 15:36:43 +08:00
co-authored by Codex
parent ac36f5bc13
commit dacdd3f0e2
4 changed files with 7 additions and 12 deletions
@@ -225,13 +225,8 @@ async fn privacy_steps_migration_preserves_rules_and_other_settings() {
serde_json::to_value(&loaded.values.codex_privacy_policy).unwrap(),
expected
);
// 已迁移的规则再次执行转换也不产生写入或额外嵌套
sqlx::raw_sql(include_str!(
"../../../../migrations/0032_privacy_rule_steps.sql"
))
.execute(&database.pool)
.await
.unwrap();
// 服务重启后再次检查迁移,不产生写入或额外嵌套
super::TEST_MIGRATOR.run(&database.pool).await.unwrap();
let stored: serde_json::Value =
sqlx::query_scalar("select to_jsonb(runtime_settings) from runtime_settings where id = 1")
.fetch_one(&database.pool)
@@ -271,7 +266,7 @@ async fn privacy_steps_migration_rejects_non_object_without_losing_data() {
.unwrap();
assert_eq!(stored, invalid);
let applied: bool =
sqlx::query_scalar("select exists(select 1 from _sqlx_migrations where version = 32)")
sqlx::query_scalar("select exists(select 1 from _sqlx_migrations where version = 31)")
.fetch_one(&database.pool)
.await
.unwrap();
+1 -2
View File
@@ -28,5 +28,4 @@ d4b599066d7382a1c9cb6b3c003200046579e4fce3531f232cbd665a9d92c542 0026_codex_pri
31d6668707186d7c19cdd507e20162a08c7fbb8ba41ff4a4439d0a5e08369cad 0028_request_analytics.sql
1923f14095dac5f808a530db002c37e17168afa0778bc7f3da768c818133eec9 0029_usage_indexes_and_identity_snapshots.sql
f10058e2b4c974b6d2ffa11be78b085504a233205253948c03357ef6fe234bca 0030_analytics_and_scheduling.sql
252ba957fa5c4f5171aee2aa238f2da7202a7c53dc6245ee4a210626089ec5a7 0031_outbound_proxy_enabled.sql
24b786f80a8bdebe3d915f60a9d68d5c7c9fc04fd4eaa9912f5d7a997fefa87f 0032_privacy_rule_steps.sql
b49832e205405de7ef078f3b65c0c19f2c030b8984d42411598738b6b6c146bf 0031_proxy_and_privacy.sql
@@ -1,2 +0,0 @@
-- 命名代理独立启停,保留连接配置和账号绑定
alter table outbound_proxies add column enabled boolean not null default true;
@@ -1,3 +1,6 @@
-- 命名代理独立启停,保留连接配置和账号绑定
alter table outbound_proxies add column enabled boolean not null default true;
-- 非对象规则不能无损转换,拒绝升级以保留原始配置
do $$
begin