
- Add is_divisible_by_3 field to database model and schema - Create migration script for the new field - Update existing endpoints to check divisibility by 3 - Add dedicated endpoints for divisibility by 3 - Update README with new endpoint documentation - Fix linting issues with ruff
34 lines
746 B
Python
34 lines
746 B
Python
"""Add is_divisible_by_3 column
|
|
|
|
Revision ID: 002
|
|
Revises: 001
|
|
Create Date: 2023-05-15
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "002"
|
|
down_revision = "001"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Add is_divisible_by_3 column with default value of False
|
|
with op.batch_alter_table("number_checks") as batch_op:
|
|
batch_op.add_column(
|
|
sa.Column(
|
|
"is_divisible_by_3", sa.Boolean(), nullable=False, server_default="0"
|
|
)
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
# Remove is_divisible_by_3 column
|
|
with op.batch_alter_table("number_checks") as batch_op:
|
|
batch_op.drop_column("is_divisible_by_3")
|