Files
pear-admin-flask/migrations/versions/9ae98ba6025b_add_cookie_manager_table.py
T
bwstudio 3e8c490851 feat(plugins): Cookie 管理插件(账号/站点 + 刷新记录)
以插件方式新增 Cookie 管理模块,不改动 framework 业务逻辑。

数据层
- CookieUser / CookieSite 两个模型(applications/models/admin_cookie.py)
- 对应 ManageSchema(applications/schemas/admin_cookie.py)
- 模型与 schema 在 applications/{models,schemas}/__init__.py 中注册,便于 Alembic 跟踪
- 新增两个迁移脚本(cookie_site / cookie_user + cookie 站点表)

插件
- plugins/cookieManager/:入口 __init__.py + 三个视图(概览 / 账号 / 站点)
- 后台模板:cookie_user 与 cookie_site 各自的 main/add/edit
- 路由前缀 /system/cookie-user/*、/system/cookie-site/*
2026-09-09 19:17:41 +08:00

46 lines
1.9 KiB
Python

"""add cookie_manager table
Revision ID: 9ae98ba6025b
Revises: a47a5d2a3f1b
Create Date: 2026-09-08 15:23:56.125419
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9ae98ba6025b'
down_revision = 'a47a5d2a3f1b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('admin_cookie_manager',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='主键ID'),
sa.Column('website_id', sa.Integer(), nullable=False, comment='网站ID'),
sa.Column('website_name', sa.String(length=100), nullable=True, comment='网站名称'),
sa.Column('website_url', sa.String(length=255), nullable=True, comment='网站URL'),
sa.Column('name', sa.String(length=100), nullable=False, comment='Cookie名称'),
sa.Column('value', sa.Text(), nullable=False, comment='Cookie值'),
sa.Column('domain', sa.String(length=255), nullable=True, comment='Cookie域名'),
sa.Column('path', sa.String(length=255), nullable=True, comment='Cookie路径'),
sa.Column('expiry', sa.DateTime(), nullable=True, comment='过期时间'),
sa.Column('secure', sa.Integer(), nullable=True, comment='是否安全'),
sa.Column('http_only', sa.Integer(), nullable=True, comment='是否HTTPOnly'),
sa.Column('enable', sa.Integer(), nullable=True, comment='状态(1启用,0禁用)'),
sa.Column('create_by', sa.String(length=50), nullable=True, comment='创建者'),
sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'),
sa.Column('update_at', sa.DateTime(), nullable=True, comment='更新时间'),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('admin_cookie_manager')
# ### end Alembic commands ###