mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-10 10:47:56 +08:00
✨ 添加 Cookie 组件 (#633)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: f90b712557a9
|
||||
Revises: f9baef347cc8
|
||||
Create Date: 2024-09-23 10:03:30.593263
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import Text
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "f90b712557a9"
|
||||
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("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),
|
||||
sa.Column("is_universal", sa.Boolean(), nullable=False),
|
||||
sa.Column("is_anonymous", sa.Boolean(), 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 ###
|
||||
Reference in New Issue
Block a user