SubscribeHistory 表结构修复

This commit is contained in:
jxxghp
2024-10-21 13:07:47 +08:00
parent b07297c7e1
commit eeed9849ef
4 changed files with 55 additions and 18 deletions
+4 -4
View File
@@ -58,12 +58,12 @@ class ConfigModel(BaseModel):
DB_POOL_TYPE: str = "QueuePool" DB_POOL_TYPE: str = "QueuePool"
# 是否在获取连接时进行预先 ping 操作,默认关闭 # 是否在获取连接时进行预先 ping 操作,默认关闭
DB_POOL_PRE_PING: bool = False DB_POOL_PRE_PING: bool = False
# 数据库连接池的大小,默认 20 # 数据库连接池的大小,默认 100
DB_POOL_SIZE: int = 20 DB_POOL_SIZE: int = 100
# 数据库连接的回收时间(秒),默认 1800 秒 # 数据库连接的回收时间(秒),默认 1800 秒
DB_POOL_RECYCLE: int = 1800 DB_POOL_RECYCLE: int = 1800
# 数据库连接池获取连接的超时时间(秒),默认 30 秒 # 数据库连接池获取连接的超时时间(秒),默认 60 秒
DB_POOL_TIMEOUT: int = 30 DB_POOL_TIMEOUT: int = 60
# 数据库连接池最大溢出连接数,默认 10 # 数据库连接池最大溢出连接数,默认 10
DB_MAX_OVERFLOW: int = 10 DB_MAX_OVERFLOW: int = 10
# SQLite 的 busy_timeout 参数,默认为 60 秒 # SQLite 的 busy_timeout 参数,默认为 60 秒
+8 -2
View File
@@ -1,4 +1,4 @@
from sqlalchemy import Column, Integer, String, Sequence, Float from sqlalchemy import Column, Integer, String, Sequence, Float, JSON
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from app.db import db_query, Base from app.db import db_query, Base
@@ -53,13 +53,19 @@ class SubscribeHistory(Base):
# 订阅用户 # 订阅用户
username = Column(String) username = Column(String)
# 订阅站点 # 订阅站点
sites = Column(String) sites = Column(JSON)
# 是否洗版 # 是否洗版
best_version = Column(Integer, default=0) best_version = Column(Integer, default=0)
# 保存路径 # 保存路径
save_path = Column(String) save_path = Column(String)
# 是否使用 imdbid 搜索 # 是否使用 imdbid 搜索
search_imdbid = Column(Integer, default=0) search_imdbid = Column(Integer, default=0)
# 自定义识别词
custom_words = Column(String)
# 自定义媒体类别
media_category = Column(String)
# 过滤规则组
filter_groups = Column(JSON, default=list)
@staticmethod @staticmethod
@db_query @db_query
+34
View File
@@ -0,0 +1,34 @@
"""2.0.5
Revision ID: ecf3c693fdf3
Revises: a73f2dbf5c09
Create Date: 2024-10-21 12:36:20.631963
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ecf3c693fdf3'
down_revision = 'a73f2dbf5c09'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
# 将String转换为JSON类型
with contextlib.suppress(Exception):
op.alter_column('subscribehistory', 'sites', existing_type=sa.String(), type_=sa.JSON())
with contextlib.suppress(Exception):
op.add_column('subscribehistory', sa.Column('custom_words', sa.String(), nullable=True))
op.add_column('subscribehistory', sa.Column('media_category', sa.String(), nullable=True))
op.add_column('subscribehistory', sa.Column('filter_groups', sa.JSON(), nullable=True))
# ### end Alembic commands ###
def downgrade() -> None:
pass
+9 -12
View File
@@ -65,11 +65,6 @@ click==8.1.7
# uvicorn # uvicorn
cn2an==0.5.22 cn2an==0.5.22
# via -r requirements.in # via -r requirements.in
colorama==0.4.6
# via
# click
# qrcode
# tqdm
coloredlogs==15.0.1 coloredlogs==15.0.1
# via aligo # via aligo
crcmod==1.7 crcmod==1.7
@@ -102,9 +97,7 @@ frozenlist==1.4.1
func-timeout==4.3.5 func-timeout==4.3.5
# via -r requirements.in # via -r requirements.in
greenlet==2.0.2 greenlet==2.0.2
# via # via playwright
# playwright
# sqlalchemy
h11==0.14.0 h11==0.14.0
# via # via
# httpcore # httpcore
@@ -192,6 +185,14 @@ pyee==9.0.4
# via playwright # via playwright
pyjwt==2.7.0 pyjwt==2.7.0
# via -r requirements.in # via -r requirements.in
pyobjc-core==10.3.1
# via
# pyobjc-framework-cocoa
# pyobjc-framework-quartz
pyobjc-framework-cocoa==10.3.1
# via pyobjc-framework-quartz
pyobjc-framework-quartz==10.3.1
# via pystray
pyotp==2.9.0 pyotp==2.9.0
# via -r requirements.in # via -r requirements.in
pyparsing==3.0.9 pyparsing==3.0.9
@@ -200,8 +201,6 @@ pypng==0.20220715.0
# via qrcode # via qrcode
pyquery==2.0.0 pyquery==2.0.0
# via -r requirements.in # via -r requirements.in
pyreadline3==3.5.4
# via humanfriendly
pysocks==1.7.1 pysocks==1.7.1
# via requests # via requests
pystray==0.19.5 pystray==0.19.5
@@ -303,8 +302,6 @@ typing-extensions==4.12.2
# qrcode # qrcode
# sqlalchemy # sqlalchemy
# transmission-rpc # transmission-rpc
tzdata==2024.2
# via tzlocal
tzlocal==5.2 tzlocal==5.2
# via # via
# apscheduler # apscheduler