Fix foreign key reference case sensitivity and standardize column definitions in inventory models
This commit is contained in:
parent
65dcbbfb0b
commit
f7fae7dc9b
2 changed files with 3 additions and 4 deletions
|
@ -20,7 +20,7 @@ class Inventory(db.Model):
|
||||||
id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True)
|
id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True)
|
||||||
timestamp: Mapped[datetime.datetime] = mapped_column(DateTime)
|
timestamp: Mapped[datetime.datetime] = mapped_column(DateTime)
|
||||||
condition: Mapped[str] = mapped_column(Unicode(255))
|
condition: Mapped[str] = mapped_column(Unicode(255))
|
||||||
type_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("Items.ID"), nullable=True)
|
type_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("Items.id"), nullable=True)
|
||||||
name: Mapped[Optional[str]] = mapped_column(Unicode(255))
|
name: Mapped[Optional[str]] = mapped_column(Unicode(255))
|
||||||
serial: Mapped[Optional[str]] = mapped_column(Unicode(255))
|
serial: Mapped[Optional[str]] = mapped_column(Unicode(255))
|
||||||
model: Mapped[Optional[str]] = mapped_column(Unicode(255))
|
model: Mapped[Optional[str]] = mapped_column(Unicode(255))
|
||||||
|
|
|
@ -13,9 +13,8 @@ class Item(ValidatableMixin, db.Model):
|
||||||
__tablename__ = 'Items'
|
__tablename__ = 'Items'
|
||||||
VALIDATION_LABEL = 'Item'
|
VALIDATION_LABEL = 'Item'
|
||||||
|
|
||||||
id: Mapped[int] = mapped_column("ID", Integer, Identity(start=1, increment=1), primary_key=True)
|
id: Mapped[int] = mapped_column(Integer, Identity(start=1, increment=1), primary_key=True)
|
||||||
description: Mapped[Optional[str]] = mapped_column("Description", Unicode(255), nullable=True)
|
description: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True)
|
||||||
category: Mapped[Optional[str]] = mapped_column("Category", Unicode(255), nullable=True)
|
|
||||||
|
|
||||||
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='item')
|
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='item')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue