feat: 增加管理后台的会话、配置和用户管理
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"""系统配置、刷新暂停和刷新结论。"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision = "0004_admin_settings"
|
||||
down_revision = "0003_credentials"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table("accounts") as batch:
|
||||
batch.add_column(sa.Column("refresh_paused", sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
batch.add_column(sa.Column("last_refresh_at", sa.DateTime(timezone=True), nullable=True))
|
||||
batch.add_column(sa.Column("credential_valid", sa.Boolean(), nullable=True))
|
||||
op.create_table(
|
||||
"system_config",
|
||||
sa.Column("id", sa.Integer(), primary_key=True),
|
||||
sa.Column("refresh_interval_minutes", sa.Integer(), nullable=False, server_default="30"),
|
||||
sa.Column("show_manual_jigsaw", sa.Boolean(), nullable=False, server_default=sa.true()),
|
||||
sa.Column("manual_preference", sa.Boolean(), nullable=False, server_default=sa.false()),
|
||||
sa.Column("auto_jigsaw_attempts", sa.Integer(), nullable=False, server_default="3"),
|
||||
sa.Column("admin_username", sa.String(length=64), nullable=False),
|
||||
sa.Column("admin_password_cipher", sa.Text(), nullable=False),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("system_config")
|
||||
with op.batch_alter_table("accounts") as batch:
|
||||
batch.drop_column("credential_valid")
|
||||
batch.drop_column("last_refresh_at")
|
||||
batch.drop_column("refresh_paused")
|
||||
Reference in New Issue
Block a user