mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
fix: 修复迁移脚本对非对象类型 headers 的处理
在 headers -> header_rules 迁移时,添加 jsonb_typeof 类型检查, 避免 jsonb_each_text 在非对象类型数据上报错。
This commit is contained in:
@@ -54,6 +54,7 @@ def upgrade() -> None:
|
|||||||
)
|
)
|
||||||
WHERE headers IS NOT NULL
|
WHERE headers IS NOT NULL
|
||||||
AND headers::text != '{}'
|
AND headers::text != '{}'
|
||||||
|
AND jsonb_typeof(headers::jsonb) = 'object'
|
||||||
AND header_rules IS NULL
|
AND header_rules IS NULL
|
||||||
""")
|
""")
|
||||||
)
|
)
|
||||||
@@ -94,6 +95,7 @@ def downgrade() -> None:
|
|||||||
AND rule->>'key' IS NOT NULL
|
AND rule->>'key' IS NOT NULL
|
||||||
)
|
)
|
||||||
WHERE header_rules IS NOT NULL
|
WHERE header_rules IS NOT NULL
|
||||||
|
AND jsonb_typeof(header_rules::jsonb) = 'array'
|
||||||
AND jsonb_array_length(header_rules::jsonb) > 0
|
AND jsonb_array_length(header_rules::jsonb) > 0
|
||||||
""")
|
""")
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user