64 lines
3.6 KiB
Python
64 lines
3.6 KiB
Python
"""新增stmp相关配置
|
|
|
|
Revision ID: 6eb27fce64de
|
|
Revises: 8e3ac0236b27
|
|
Create Date: 2026-03-20 09:36:42.899296
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '6eb27fce64de'
|
|
down_revision: Union[str, None] = '8e3ac0236b27'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('settings', sa.Column('smtp_provider', sa.String(length=50), server_default='qq', nullable=False, comment='SMTP 提供商'))
|
|
op.add_column('settings', sa.Column('smtp_host', sa.String(length=255), nullable=True, comment='SMTP 主机'))
|
|
op.add_column('settings', sa.Column('smtp_port', sa.Integer(), server_default='465', nullable=False, comment='SMTP 端口'))
|
|
op.add_column('settings', sa.Column('smtp_username', sa.String(length=255), nullable=True, comment='SMTP 用户名'))
|
|
op.add_column('settings', sa.Column('smtp_password', sa.String(length=500), nullable=True, comment='SMTP 密码或授权码'))
|
|
op.add_column('settings', sa.Column('smtp_use_tls', sa.Boolean(), server_default='0', nullable=False, comment='是否启用 TLS'))
|
|
op.add_column('settings', sa.Column('smtp_use_ssl', sa.Boolean(), server_default='1', nullable=False, comment='是否启用 SSL'))
|
|
op.add_column('settings', sa.Column('smtp_from_email', sa.String(length=255), nullable=True, comment='发件人邮箱'))
|
|
op.add_column('settings', sa.Column('smtp_from_name', sa.String(length=255), server_default='MuMuAINovel', nullable=False, comment='发件人名称'))
|
|
op.add_column('settings', sa.Column('email_auth_enabled', sa.Boolean(), server_default='1', nullable=False, comment='是否启用邮箱认证'))
|
|
op.add_column('settings', sa.Column('email_register_enabled', sa.Boolean(), server_default='1', nullable=False, comment='是否启用邮箱注册'))
|
|
op.add_column('settings', sa.Column('verification_code_ttl_minutes', sa.Integer(), server_default='10', nullable=False, comment='验证码有效期(分钟)'))
|
|
op.add_column('settings', sa.Column('verification_resend_interval_seconds', sa.Integer(), server_default='60', nullable=False, comment='验证码重发间隔(秒)'))
|
|
op.alter_column('settings', 'cover_enabled',
|
|
existing_type=sa.BOOLEAN(),
|
|
server_default='0',
|
|
existing_comment='是否启用封面图片生成',
|
|
existing_nullable=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.alter_column('settings', 'cover_enabled',
|
|
existing_type=sa.BOOLEAN(),
|
|
server_default=None,
|
|
existing_comment='是否启用封面图片生成',
|
|
existing_nullable=False)
|
|
op.drop_column('settings', 'verification_resend_interval_seconds')
|
|
op.drop_column('settings', 'verification_code_ttl_minutes')
|
|
op.drop_column('settings', 'email_register_enabled')
|
|
op.drop_column('settings', 'email_auth_enabled')
|
|
op.drop_column('settings', 'smtp_from_name')
|
|
op.drop_column('settings', 'smtp_from_email')
|
|
op.drop_column('settings', 'smtp_use_ssl')
|
|
op.drop_column('settings', 'smtp_use_tls')
|
|
op.drop_column('settings', 'smtp_password')
|
|
op.drop_column('settings', 'smtp_username')
|
|
op.drop_column('settings', 'smtp_port')
|
|
op.drop_column('settings', 'smtp_host')
|
|
op.drop_column('settings', 'smtp_provider')
|
|
# ### end Alembic commands ### |