fix: 修两个 bug

1. ArticleRead.user_id 改 Integer(users.id 是 Integer,不是 BigInteger)
   alembic 0007 同样改 Integer
2. ArticleDetail.vue toggleRead 重复 catch 块导致 build 失败
   (edit 时新加的 catch 跟 toggleStar 残留的 catch 撞了)
This commit is contained in:
xiaji
2026-06-13 21:10:22 +08:00
parent 6c71ab2e79
commit 4ca05b8b7d
3 changed files with 5 additions and 7 deletions

View File

@@ -9,12 +9,13 @@
注意:
- 删文章时 ondelete=CASCADE 自动清掉已读记录
- 这是和 bookmarks 并列的"用户行为"
- user_id 是 Integer(users.id 是 Integer),article_id 是 BigInteger(articles.id 是 BigInteger)
"""
from __future__ import annotations
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, ForeignKey, Index, func
from sqlalchemy import BigInteger, DateTime, ForeignKey, Index, Integer, func
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
@@ -24,7 +25,7 @@ class ArticleRead(Base):
__tablename__ = "article_reads"
user_id: Mapped[int] = mapped_column(
ForeignKey("users.id", ondelete="CASCADE"), primary_key=True
Integer, ForeignKey("users.id", ondelete="CASCADE"), primary_key=True
)
article_id: Mapped[int] = mapped_column(
BigInteger,