mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-10 18:57:56 +08:00
✨ 在 cookie 中添加 cookie_name 字段
This commit is contained in:
@@ -298,6 +298,7 @@ class DBConfig:
|
||||
if not cookie_in_db:
|
||||
raise ValueError(f"cookie {cookie.id} not found")
|
||||
cookie_in_db.content = cookie.content
|
||||
cookie_in_db.cookie_name = cookie.cookie_name
|
||||
cookie_in_db.last_usage = cookie.last_usage
|
||||
cookie_in_db.status = cookie.status
|
||||
cookie_in_db.tags = cookie.tags
|
||||
|
||||
@@ -74,6 +74,8 @@ class Cookie(Model):
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
site_name: Mapped[str] = mapped_column(String(100))
|
||||
content: Mapped[str] = mapped_column(String(1024))
|
||||
# Cookie 的友好名字,类似于 Target 的 target_name,用于展示
|
||||
cookie_name: Mapped[str] = mapped_column(String(1024), default="unnamed cookie")
|
||||
# 最后使用的时刻
|
||||
last_usage: Mapped[datetime.datetime] = mapped_column(DateTime, default=datetime.datetime(1970, 1, 1))
|
||||
# Cookie 当前的状态
|
||||
|
||||
+4
-3
@@ -1,8 +1,8 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: ef796b74b0fe
|
||||
Revision ID: f90b712557a9
|
||||
Revises: f9baef347cc8
|
||||
Create Date: 2024-09-13 00:34:08.601438
|
||||
Create Date: 2024-09-23 10:03:30.593263
|
||||
|
||||
"""
|
||||
|
||||
@@ -12,7 +12,7 @@ from sqlalchemy import Text
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "ef796b74b0fe"
|
||||
revision = "f90b712557a9"
|
||||
down_revision = "f9baef347cc8"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@@ -25,6 +25,7 @@ def upgrade() -> None:
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("site_name", sa.String(length=100), nullable=False),
|
||||
sa.Column("content", sa.String(length=1024), nullable=False),
|
||||
sa.Column("cookie_name", sa.String(length=1024), nullable=False),
|
||||
sa.Column("last_usage", sa.DateTime(), nullable=False),
|
||||
sa.Column("status", sa.String(length=20), nullable=False),
|
||||
sa.Column("cd_milliseconds", sa.Integer(), nullable=False),
|
||||
Reference in New Issue
Block a user