This commit is contained in:
parent
26428e8cb8
commit
794721a0cb
@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from .db import db
|
from .db import db
|
||||||
from .mealingredient import MealIngredient
|
|
||||||
|
|
||||||
|
|
||||||
class Ingredient(db.Model):
|
class Ingredient(db.Model):
|
||||||
__tablename__ = 'Ingredient'
|
__tablename__ = 'Ingredient'
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
name = db.Column(db.String, nullable=False, unique=True)
|
name = db.Column(db.String, nullable=False, unique=True)
|
||||||
value = db.Column(db.String, nullable=False)
|
|
||||||
items = db.relationship('Meal', secondary=MealIngredient.__tablename__, back_populates='Ingredient')
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from .db import db
|
from .db import db
|
||||||
from .mealingredient import MealIngredient
|
|
||||||
|
|
||||||
|
|
||||||
class Meal(db.Model):
|
class Meal(db.Model):
|
||||||
@ -13,4 +12,4 @@ class Meal(db.Model):
|
|||||||
spicy = db.Column(db.Boolean, nullable=False, default=False)
|
spicy = db.Column(db.Boolean, nullable=False, default=False)
|
||||||
vegan = db.Column(db.Boolean, nullable=False, default=False)
|
vegan = db.Column(db.Boolean, nullable=False, default=False)
|
||||||
glutenfree = db.Column(db.Boolean, nullable=False, default=False)
|
glutenfree = db.Column(db.Boolean, nullable=False, default=False)
|
||||||
ingredients = db.relationship('Ingredient', secondary=MealIngredient.__tablename__, back_populates='Meal')
|
ingredients = db.relationship('Ingredient', backref='Meal', lazy='dynamic')
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
from .db import db
|
|
||||||
|
|
||||||
|
|
||||||
class MealIngredient(db.Model):
|
|
||||||
__tablename__ = 'MealIngredient'
|
|
||||||
id = db.Column(db.Integer, primary_key=True, index=True)
|
|
||||||
itemId = db.Column(db.Integer, db.ForeignKey('Meal.id'))
|
|
||||||
detailId = db.Column(db.Integer, db.ForeignKey('Ingredient.id'))
|
|
Loading…
Reference in New Issue
Block a user