合入 W2-a 的复核修复(nr8/a:导入的 NOT NULL 补值与孤儿行、收尾 dispose、sslmode 换算、PostgreSQL 写入去 NUL、不分大小写搜索 contains_ci、json_eq 两库同语义、JSON 守卫、用户可见列表补决胜键、bubblewrap --clearenv、部署脚本与原子写的几处、README 连接数预算)

# Conflicts:
#	backend/app/api/schedules.py
#	backend/app/main.py
This commit is contained in:
ThearchyHelios
2026-10-19 12:21:38 +08:00
80 changed files with 995 additions and 201 deletions
+3 -3
View File
@@ -47,6 +47,7 @@ from app.core.errors import describe_exception, first_line
from app.data.names import name_key
from app.db.base import SessionLocal, utcnow
from app.db.models_sources import SourceObject
from app.db.portable import contains_ci
logger = logging.getLogger(__name__)
@@ -879,9 +880,8 @@ async def search_index(session: AsyncSession, row: Any, query: str, *, limit: in
return [], 0
key = name_key(text.rsplit(".", 1)[-1])
filt = (*_scope_filter(row.id, index_schema(row)), SourceObject.removed_at.is_(None),
# 名字比的是 name_key(ASCII 已转小写);注释要不分大小写:SQLite 的 LIKE 本来就不分(ASCII),PostgreSQL 分
or_(SourceObject.name_key.contains(key, autoescape=True),
SourceObject.comment.icontains(text, autoescape=True)))
# 名字比的是 name_key(ASCII 已转小写);注释要不分大小写(db/portable.contains_ci:两种库都折 Unicode 的大小写)
or_(SourceObject.name_key.contains(key, autoescape=True), contains_ci(SourceObject.comment, text)))
total = int((await session.execute(select(func.count()).select_from(SourceObject).where(*filt))).scalar() or 0)
rows = (await session.execute(
select(SourceObject.name, SourceObject.name_key, SourceObject.kind, SourceObject.comment,