fix: 迁移脚本创建 video endpoint 时补充 created_at/updated_at 字段

修复 create_video_endpoints() 函数 INSERT 语句缺少时间戳字段导致的
NOT NULL 约束错误。
This commit is contained in:
fawney19
2026-02-01 17:36:48 +08:00
parent 4ac8e63c94
commit feb7484fda

View File

@@ -9,6 +9,7 @@ Create Date: 2026-01-31 15:30:00.000000
from __future__ import annotations from __future__ import annotations
import json import json
from datetime import datetime, timezone
from typing import Sequence, Union from typing import Sequence, Union
from uuid import uuid4 from uuid import uuid4
@@ -261,6 +262,7 @@ def create_video_endpoints(connection) -> None:
else: else:
continue continue
now = datetime.now(timezone.utc)
connection.execute( connection.execute(
text(""" text("""
INSERT INTO provider_endpoints INSERT INTO provider_endpoints
@@ -277,7 +279,9 @@ def create_video_endpoints(connection) -> None:
custom_path, custom_path,
config, config,
format_acceptance_config, format_acceptance_config,
proxy proxy,
created_at,
updated_at
) )
VALUES VALUES
( (
@@ -293,7 +297,9 @@ def create_video_endpoints(connection) -> None:
NULL, NULL,
:config, :config,
:format_acceptance_config, :format_acceptance_config,
:proxy :proxy,
:created_at,
:updated_at
) )
"""), """),
{ {
@@ -308,6 +314,8 @@ def create_video_endpoints(connection) -> None:
"config": _json_dumps(_json_loads(row.config)), "config": _json_dumps(_json_loads(row.config)),
"format_acceptance_config": _json_dumps(_json_loads(row.format_acceptance_config)), "format_acceptance_config": _json_dumps(_json_loads(row.format_acceptance_config)),
"proxy": _json_dumps(_json_loads(row.proxy)), "proxy": _json_dumps(_json_loads(row.proxy)),
"created_at": now,
"updated_at": now,
}, },
) )