-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
17 lines (15 loc) · 714 Bytes
/
models.py
File metadata and controls
17 lines (15 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Product(db.Model):
product_id = db.Column(db.String, primary_key=True)
name = db.Column(db.String, nullable=False)
class Location(db.Model):
location_id = db.Column(db.String, primary_key=True)
name = db.Column(db.String, nullable=False)
class ProductMovement(db.Model):
movement_id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime)
from_location = db.Column(db.String, db.ForeignKey('location.location_id'))
to_location = db.Column(db.String, db.ForeignKey('location.location_id'))
product_id = db.Column(db.String, db.ForeignKey('product.product_id'))
qty = db.Column(db.Integer)