19 lines
629 B
Python
19 lines
629 B
Python
from sqlalchemy import ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.core.database import Base
|
|
from app.models.manufacturer import Manufacturer
|
|
|
|
|
|
class ScopeModel(Base):
|
|
__tablename__ = "scope_models"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
name: Mapped[str] = mapped_column(nullable=False)
|
|
manufacturer_id: Mapped[int] = mapped_column(
|
|
ForeignKey("manufacturers.id", ondelete="RESTRICT"), nullable=False
|
|
)
|
|
url: Mapped[str | None] = mapped_column(nullable=True, default=None)
|
|
|
|
manufacturer: Mapped[Manufacturer] = relationship(lazy="selectin")
|