mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-30 03:09:58 +00:00
Update models.py
Base class no longer required plate to be unique, Allowed Plates do need to be unique
This commit is contained in:
@@ -6,7 +6,7 @@ from application import db
|
|||||||
class Plate(db.Model):
|
class Plate(db.Model):
|
||||||
__abstract__ = True
|
__abstract__ = True
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
plate = db.Column(db.String(40), unique=True, nullable=False)
|
plate = db.Column(db.String(40), nullable=False)
|
||||||
|
|
||||||
|
|
||||||
class LoggedItem(Plate):
|
class LoggedItem(Plate):
|
||||||
@@ -27,6 +27,7 @@ class LoggedItem(Plate):
|
|||||||
|
|
||||||
class AllowedPlate(Plate):
|
class AllowedPlate(Plate):
|
||||||
__tablename__ = "AllowedPlates"
|
__tablename__ = "AllowedPlates"
|
||||||
|
__table_args__ = (db.UniqueConstraint("plate"),)
|
||||||
|
|
||||||
def __init__(self, plate: str):
|
def __init__(self, plate: str):
|
||||||
self.plate = plate
|
self.plate = plate
|
||||||
|
|||||||
Reference in New Issue
Block a user