From 3bd0867f0eb4b2cad452838c87fddb0242c900e7 Mon Sep 17 00:00:00 2001 From: suyiiyii Date: Thu, 5 Sep 2024 16:07:59 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=95=B0=E6=8D=AE=E5=BA=93Cookie?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0cd=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_bison/config/db_model.py | 1 + .../migrations/590dc2911ea7_add_cookie.py | 59 ------------------- 2 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 nonebot_bison/config/migrations/590dc2911ea7_add_cookie.py diff --git a/nonebot_bison/config/db_model.py b/nonebot_bison/config/db_model.py index 2c74721..d7c84f9 100644 --- a/nonebot_bison/config/db_model.py +++ b/nonebot_bison/config/db_model.py @@ -76,6 +76,7 @@ class Cookie(Model): content: Mapped[str] = mapped_column(String(1024)) last_usage: Mapped[datetime.datetime] = mapped_column(DateTime, default=datetime.datetime(1970, 1, 1)) status: Mapped[str] = mapped_column(String(20), default="") + cd: Mapped[int] = mapped_column(default=0) tags: Mapped[dict[str, Any]] = mapped_column(JSON().with_variant(JSONB, "postgresql"), default={}) targets: Mapped[list["CookieTarget"]] = relationship(back_populates="cookie") diff --git a/nonebot_bison/config/migrations/590dc2911ea7_add_cookie.py b/nonebot_bison/config/migrations/590dc2911ea7_add_cookie.py deleted file mode 100644 index c8fbd1d..0000000 --- a/nonebot_bison/config/migrations/590dc2911ea7_add_cookie.py +++ /dev/null @@ -1,59 +0,0 @@ -"""empty message - -Revision ID: 590dc2911ea7 -Revises: f9baef347cc8 -Create Date: 2024-08-31 23:06:02.123932 - -""" - -import sqlalchemy as sa -from alembic import op -from sqlalchemy import Text -from sqlalchemy.dialects import postgresql - -# revision identifiers, used by Alembic. -revision = "590dc2911ea7" -down_revision = "f9baef347cc8" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "nonebot_bison_cookie", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("platform_name", sa.String(length=20), nullable=False), - sa.Column("content", 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("tags", sa.JSON().with_variant(postgresql.JSONB(astext_type=Text()), "postgresql"), nullable=False), - sa.PrimaryKeyConstraint("id", name=op.f("pk_nonebot_bison_cookie")), - ) - op.create_table( - "nonebot_bison_cookietarget", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("target_id", sa.Integer(), nullable=False), - sa.Column("cookie_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["cookie_id"], - ["nonebot_bison_cookie.id"], - name=op.f("fk_nonebot_bison_cookietarget_cookie_id_nonebot_bison_cookie"), - ondelete="CASCADE", - ), - sa.ForeignKeyConstraint( - ["target_id"], - ["nonebot_bison_target.id"], - name=op.f("fk_nonebot_bison_cookietarget_target_id_nonebot_bison_target"), - ondelete="CASCADE", - ), - sa.PrimaryKeyConstraint("id", name=op.f("pk_nonebot_bison_cookietarget")), - ) - # ### end Alembic commands ### - - -def downgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table("nonebot_bison_cookietarget") - op.drop_table("nonebot_bison_cookie") - # ### end Alembic commands ###