feat: 定时开始日改为每月5到25号,默认8号

This commit is contained in:
2026-11-16 11:59:14 +08:00
parent 0d7de2eac3
commit 019e75a95e
9 changed files with 101 additions and 51 deletions
@@ -0,0 +1,30 @@
"""定时开始日限制为每月 5 到 25 号,超出范围的旧值改为 8 号。"""
from alembic import op
import sqlalchemy as sa
revision = "0007_study_start_day"
down_revision = "0006_employee_width"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.execute("UPDATE accounts SET study_start_day = 8 WHERE study_start_day < 5 OR study_start_day > 25")
with op.batch_alter_table("accounts") as batch:
batch.alter_column(
"study_start_day",
existing_type=sa.Integer(),
existing_nullable=False,
server_default="8",
)
def downgrade() -> None:
with op.batch_alter_table("accounts") as batch:
batch.alter_column(
"study_start_day",
existing_type=sa.Integer(),
existing_nullable=False,
server_default="1",
)