feat: 定时开始日改为每月5到25号,默认8号
This commit is contained in:
@@ -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",
|
||||
)
|
||||
Reference in New Issue
Block a user