Beispiel #1
0
class OrderLine(db.Model):
    __tablename__ = "order_lines"

    order_line_id = db.Column(db.Integer, primary_key=True)
    order_id = db.Column(db.Integer, db.ForeignKey("orders.order_id"), nullable=False)
    good_id = db.Column(db.Integer, db.ForeignKey("goods.good_id"), nullable=False)

    good = db.relationship("Good")
Beispiel #2
0
class Order(db.Model):
    __tablename__ = "orders"

    order_id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey("users.user_id"), nullable=False)
    created_time = db.Column(DateTime, default=datetime.datetime.utcnow)
    store_id = db.Column(db.Integer, db.ForeignKey("stores.store_id"), nullable=False)

    order_lines = db.relationship("OrderLine", backref="order")
Beispiel #3
0
class Store(db.Model):
    __tablename__ = "stores"

    store_id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(), nullable=False)
    city = db.Column(db.String(), nullable=False)
    address = db.Column(db.String(), nullable=False)
    manager_id = db.Column(db.Integer, db.ForeignKey("users.user_id"), nullable=False)

    orders = db.relationship("Order", backref="store")