Assign printers to a MACHINE and let whichever PC controls it install them, with the observed half kept strictly apart from the assigned half: a collector report can never write an assignment row. Adoption is explicit. Adds a singular relationship type so defaultprinter can mean exactly one, client scripts that converge a bay's queues and correct a drifted one in place, and a wave gate so a fleet-wide driver rollout cannot stampede its own share. On the container side: the compose stack never persisted the instance directory, so a rebuild discarded plugins.json and every upload. It is a volume now, the image ships instance/ owned by the app user so the mountpoint is writable, and the database moves to MySQL 8.4 LTS, which the Windows runbook has recommended since 8.0 went end of life. The image also could not build at all: the frontend stage never copied the plugin staging script it runs. Adds a topology migration guide covering IIS to Docker and back.
45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
"""Printer driver: a named link (SMB path or HTTP URL) to driver files."""
|
|
|
|
from shopdb.api import db
|
|
|
|
|
|
class PrinterDriver(db.Model):
|
|
__tablename__ = 'printerdrivers'
|
|
|
|
driverid = db.Column(db.Integer, primary_key=True)
|
|
name = db.Column(db.String(150), nullable=False)
|
|
# SMB path (\\\\server\\share\\...) or HTTP URL to the driver package
|
|
location = db.Column(db.String(500), nullable=False)
|
|
description = db.Column(db.Text)
|
|
# Exact driver name as the INF declares it: Add-PrinterDriver matches on
|
|
# this string, not on `name`, which is ours to choose
|
|
drivername = db.Column(db.String(255))
|
|
# Optional: attach a driver to a whole VENDOR rather than one model. A
|
|
# universal driver (HP UPD, Xerox GPD) serves every printer of that make, and
|
|
# binding it to one model would mean a near-duplicate row per model.
|
|
# Model wins over vendor when both match - see _printer_driver.
|
|
vendorid = db.Column(db.Integer, nullable=True, index=True)
|
|
|
|
# Optional: attach a driver to a specific printer model
|
|
modelnumberid = db.Column(
|
|
db.Integer,
|
|
db.ForeignKey('models.modelnumberid'),
|
|
nullable=True
|
|
)
|
|
isactive = db.Column(db.Boolean, default=True, nullable=False)
|
|
|
|
model = db.relationship('Model')
|
|
|
|
def to_dict(self):
|
|
return {
|
|
'driverid': self.driverid,
|
|
'name': self.name,
|
|
'location': self.location,
|
|
'description': self.description,
|
|
'drivername': self.drivername,
|
|
'vendorid': self.vendorid,
|
|
'modelnumberid': self.modelnumberid,
|
|
'modelname': self.model.modelnumber if self.model else None,
|
|
'isactive': bool(self.isactive),
|
|
}
|