Files
cproudlock 1196de6e88 Initial commit: Shop Database Flask Application
Flask backend with Vue 3 frontend for shop floor machine management.
Includes database schema export for MySQL shopdb_flask database.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 16:07:34 -05:00

44 lines
1.2 KiB
Python

"""Model (equipment model number) model."""
from shopdb.extensions import db
from .base import BaseModel
class Model(BaseModel):
"""Equipment/device model information."""
__tablename__ = 'models'
modelnumberid = db.Column(db.Integer, primary_key=True)
modelnumber = db.Column(db.String(100), nullable=False)
# Link to machine type (what kind of equipment this model is for)
machinetypeid = db.Column(
db.Integer,
db.ForeignKey('machinetypes.machinetypeid'),
nullable=True
)
# Link to vendor/manufacturer
vendorid = db.Column(
db.Integer,
db.ForeignKey('vendors.vendorid'),
nullable=True
)
description = db.Column(db.Text)
imageurl = db.Column(db.String(500), comment='URL to product image')
documentationurl = db.Column(db.String(500), comment='URL to documentation')
notes = db.Column(db.Text)
# Relationships
machinetype = db.relationship('MachineType', backref='models')
vendor = db.relationship('Vendor', backref='models')
# Unique constraint on modelnumber + vendor
__table_args__ = (
db.UniqueConstraint('modelnumber', 'vendorid', name='uq_model_vendor'),
)
def __repr__(self):
return f"<Model {self.modelnumber}>"