fix: 修复迁移脚本对非对象类型 headers 的处理

在 headers -> header_rules 迁移时,添加 jsonb_typeof 类型检查,
避免 jsonb_each_text 在非对象类型数据上报错。
This commit is contained in:
fawney19
2026-01-16 01:26:45 +08:00
parent 8e11f3864a
commit b1cf348abb

View File

@@ -54,6 +54,7 @@ def upgrade() -> None:
)
WHERE headers IS NOT NULL
AND headers::text != '{}'
AND jsonb_typeof(headers::jsonb) = 'object'
AND header_rules IS NULL
""")
)
@@ -94,6 +95,7 @@ def downgrade() -> None:
AND rule->>'key' IS NOT NULL
)
WHERE header_rules IS NOT NULL
AND jsonb_typeof(header_rules::jsonb) = 'array'
AND jsonb_array_length(header_rules::jsonb) > 0
""")
)