from sqlalchemy import Boolean, String from sqlalchemy.orm import Mapped, mapped_column from app.models.base import Base class Department(Base): __tablename__ = "departments" id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) name: Mapped[str] = mapped_column(String(100), unique=True) # Deactivated values are hidden from new-NCR forms but remain valid on # existing records; values referenced by NCRs are never hard-deleted. is_active: Mapped[bool] = mapped_column(Boolean, default=True) class DeviationCategory(Base): __tablename__ = "deviation_categories" id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) name: Mapped[str] = mapped_column(String(100), unique=True) is_active: Mapped[bool] = mapped_column(Boolean, default=True)