All checks were successful
Deploy to Production / deploy (push) Successful in 1m8s
- GAP 2+4: auto_time/date counter auto-computation with manual update blocking - GAP 3: auto-generate alarms on inspection completion for failed items - GAP 1: machine spec fields (manufacturer, location, capacity, power, description) - GAP 5: enhanced mobile responsive CSS (768px/480px breakpoints) - Alembic migration for new columns, seed data enriched with specs and date-type parts
62 lines
2.0 KiB
Python
62 lines
2.0 KiB
Python
"""add machine spec fields and alarm inspection_session_id
|
|
|
|
Revision ID: d6e7f8a9b0c1
|
|
Revises: c5d6e7f8a9b0
|
|
Create Date: 2026-02-10 15:00:00.000000
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
revision: str = "d6e7f8a9b0c1"
|
|
down_revision: Union[str, None] = "c5d6e7f8a9b0"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column("machines", sa.Column("manufacturer", sa.String(100), nullable=True))
|
|
op.add_column(
|
|
"machines",
|
|
sa.Column(
|
|
"installation_date", postgresql.TIMESTAMP(timezone=True), nullable=True
|
|
),
|
|
)
|
|
op.add_column("machines", sa.Column("location", sa.String(200), nullable=True))
|
|
op.add_column(
|
|
"machines", sa.Column("rated_capacity", sa.String(100), nullable=True)
|
|
)
|
|
op.add_column("machines", sa.Column("power_rating", sa.String(100), nullable=True))
|
|
op.add_column("machines", sa.Column("description", sa.Text, nullable=True))
|
|
|
|
op.add_column(
|
|
"alarms",
|
|
sa.Column(
|
|
"inspection_session_id",
|
|
postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("inspection_sessions.id"),
|
|
nullable=True,
|
|
),
|
|
)
|
|
op.alter_column("alarms", "equipment_part_id", nullable=True)
|
|
op.alter_column("alarms", "machine_id", nullable=True)
|
|
op.alter_column("alarms", "lifecycle_pct_at_trigger", nullable=True)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.alter_column("alarms", "lifecycle_pct_at_trigger", nullable=False)
|
|
op.alter_column("alarms", "machine_id", nullable=False)
|
|
op.alter_column("alarms", "equipment_part_id", nullable=False)
|
|
op.drop_column("alarms", "inspection_session_id")
|
|
|
|
op.drop_column("machines", "description")
|
|
op.drop_column("machines", "power_rating")
|
|
op.drop_column("machines", "rated_capacity")
|
|
op.drop_column("machines", "location")
|
|
op.drop_column("machines", "installation_date")
|
|
op.drop_column("machines", "manufacturer")
|