Refactor mapped_column parameters for consistency in models
This commit is contained in:
parent
099a9a0aaa
commit
ac05373f95
4 changed files with 8 additions and 8 deletions
|
@ -13,8 +13,8 @@ class Area(ValidatableMixin, db.Model):
|
|||
__tablename__ = 'Areas'
|
||||
VALIDATION_LABEL = "Area"
|
||||
|
||||
id: Mapped[int] = mapped_column("ID", Integer, Identity(start=1, increment=1), primary_key=True)
|
||||
name: Mapped[Optional[str]] = mapped_column("Area", Unicode(255), nullable=True)
|
||||
id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True)
|
||||
name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
|
||||
|
||||
rooms: Mapped[List['Room']] = relationship('Room', back_populates='area')
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ class Brand(ValidatableMixin, db.Model):
|
|||
__tablename__ = 'Brands'
|
||||
VALIDATION_LABEL = 'Brand'
|
||||
|
||||
id: Mapped[int] = mapped_column("ID", Integer, Identity(start=1, increment=1), primary_key=True)
|
||||
name: Mapped[str] = mapped_column("Brand", Unicode(255), nullable=False)
|
||||
id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True)
|
||||
name: Mapped[str] = mapped_column(Unicode(255), nullable=False)
|
||||
|
||||
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='brand')
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ class Inventory(db.Model):
|
|||
model: Mapped[Optional[str]] = mapped_column('Model #', Unicode(255))
|
||||
notes: Mapped[Optional[str]] = mapped_column('Notes', Unicode(255))
|
||||
owner_id = mapped_column('Owner', Integer, ForeignKey('Users.ID'))
|
||||
brand_id: Mapped[Optional[int]] = mapped_column("Brand", Integer, ForeignKey("Brands.ID"))
|
||||
brand_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("Brands.id"))
|
||||
# Photo: Mapped[Optional[str]] = mapped_column(String(8000)) Will be replacing with something that actually works.
|
||||
location_id: Mapped[Optional[str]] = mapped_column(ForeignKey("Rooms.ID"))
|
||||
barcode: Mapped[Optional[str]] = mapped_column('Bar Code', Unicode(255))
|
||||
shared: Mapped[Optional[bool]] = mapped_column(Boolean, server_default=text('((0))'))
|
||||
shared: Mapped[Optional[bool]] = mapped_column("Shared", Boolean, server_default=text('((0))'))
|
||||
|
||||
location: Mapped[Optional['Room']] = relationship('Room', back_populates='inventory')
|
||||
owner = relationship('User', back_populates='inventory')
|
||||
|
|
|
@ -18,7 +18,7 @@ class Room(ValidatableMixin, db.Model):
|
|||
|
||||
id: Mapped[int] = mapped_column("ID", Integer, Identity(start=1, increment=1), primary_key=True)
|
||||
name: Mapped[Optional[str]] = mapped_column("Room", Unicode(255), nullable=True)
|
||||
area_id: Mapped[Optional[int]] = mapped_column("Area", Integer, ForeignKey("Areas.ID"))
|
||||
area_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("Areas.id"))
|
||||
function_id: Mapped[Optional[int]] = mapped_column("Function", Integer, ForeignKey("Room Functions.ID"))
|
||||
|
||||
area: Mapped[Optional['Area']] = relationship('Area', back_populates='rooms')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue