meal_homework/mealapi/model/ingredient.py

11 lines
334 B
Python
Raw Normal View History

2022-02-13 20:38:02 +01:00
#!/usr/bin/env python3
from .db import db
class Ingredient(db.Model):
__tablename__ = 'Ingredient'
id = db.Column(db.Integer, primary_key=True)
2022-02-13 23:01:47 +01:00
name = db.Column(db.String(255), nullable=False)
2022-02-13 21:06:52 +01:00
meal_id = db.Column(db.Integer, db.ForeignKey('Meal.id'))
2022-02-13 21:36:07 +01:00
meal = db.relationship('Meal', back_populates='ingredients')