1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| from sqlalchemy import Column, DateTime, Integer, Numeric, String, Text from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Good(db.Model): __tablename__ = 'goods'
create_time = db.Column(db.DateTime) update_time = db.Column(db.DateTime) delete_time = db.Column(db.DateTime) id = db.Column(db.Integer, primary_key=True) category_id = db.Column(db.Integer, nullable=False, index=True) goods_sn = db.Column(db.String(255), nullable=False, index=True) name = db.Column(db.String(255), nullable=False) brand_id = db.Column(db.Integer, nullable=False, index=True) goods_num = db.Column(db.Integer, nullable=False, index=True) keywords = db.Column(db.String(255), nullable=False) goods_brief = db.Column(db.String(255), nullable=False) goods_desc = db.Column(db.Text) is_on_sale = db.Column(db.Integer, nullable=False) sort_order = db.Column(db.Integer, nullable=False, index=True) is_delete = db.Column(db.Integer, nullable=False) attribute_category = db.Column(db.Integer, nullable=False, index=True) counter_price = db.Column(db.Numeric(10, 2), nullable=False) extra_price = db.Column(db.Numeric(10, 2), nullable=False) is_new = db.Column(db.Integer, nullable=False) goods_unit = db.Column(db.String(255), nullable=False) primary_pic_url = db.Column(db.String(255), nullable=False) list_pic_url = db.Column(db.String(255), nullable=False) retail_price = db.Column(db.Numeric(10, 2), nullable=False) sell_volume = db.Column(db.Integer, nullable=False) primary_product_id = db.Column(db.Integer, nullable=False) unit_price = db.Column(db.Numeric(10, 2), nullable=False) promotion_desc = db.Column(db.String(255), nullable=False) promotion_tag = db.Column(db.String(255), nullable=False) app_exclusive_price = db.Column(db.Numeric(10, 2), nullable=False) is_app_exclusive = db.Column(db.Integer, nullable=False) is_limited = db.Column(db.Integer, nullable=False) is_hot = db.Column(db.Integer, nullable=False)
class GoodsAttribute(db.Model): __tablename__ = 'goods_attribute'
create_time = db.Column(db.DateTime) update_time = db.Column(db.DateTime) delete_time = db.Column(db.DateTime) id = db.Column(db.Integer, primary_key=True) goods_id = db.Column(db.Integer, nullable=False, index=True) attribute_id = db.Column(db.Integer, nullable=False, index=True) values = db.Column(db.Text)
|