Changes
Page history
Update Database design
authored
Feb 21, 2022
by
Josh Sun
Hide whitespace changes
Inline
Side-by-side
Database-design.md
View page @
8edb55cd
CREATE SCHEMA
`FreshOnline`
;
CREATE SCHEMA
`FreshOnline`
;
`stocked_goods`
: (id:int, name:varchar, type: tinyint, price: decimal2, storage: decimal2, sales: decimal2, description: text(NULL), onsale: tinyint, sale_price: decimal2(NULL), rate: float(NULL), rate_count: int(DEFAULT 0), brand: varchar, category_id: int, isnew: tinyint, pic: varchar500(
多值属性
NULL)) type==0:discrete,type==1:weight
`stocked_goods`
: (id:int, name:varchar, type: tinyint, price: decimal2, storage: decimal2, sales: decimal2, description: text(NULL), onsale: tinyint, sale_price: decimal2(NULL), rate: float(NULL), rate_count: int(DEFAULT 0), brand: varchar, category_id: int, isnew: tinyint, pic: varchar500(
multi-attribute
NULL)) type==0:discrete,type==1:weight
`category`
: (id:int, name: varchar, parent_id:int, level:int)
`category`
: (id:int, name: varchar, parent_id:int, level:int)
//level
分三级
1 2 3,
默认1级level的
parent_id
是0
//level
:
1 2 3,
categories which have level with one have a
parent_id
0.
`saled_goods`
: (order_id, goods_id, price:decimal2, count:decimal2, comment: text(NULL), rate: int(NULL))
`saled_goods`
: (order_id, goods_id, price:decimal2, count:decimal2, comment: text(NULL), rate: int(NULL))
`orders`
: (order_id, user_id, payment_method_id(NULL), order_time:datetime, pay_time:datetime(NULL), finish_time:datetime(NULL), status: tinyint, location: varchar500)
`orders`
: (order_id, user_id, payment_method_id(NULL), order_time:datetime, pay_time:datetime(NULL), finish_time:datetime(NULL), status: tinyint, location: varchar500)
// statues
已付款 已送达 订单已完成
// statues
paid, delivered, order finished
`user`
: (id, password:varchar(hashed), name: varchar, token: varchar, email:varchar(hashed), type:tinyint, location: varchar500(
多值属性
, NULL))
`user`
: (id, password:varchar(hashed), name: varchar, token: varchar, email:varchar(hashed), type:tinyint, location: varchar500(
multi-attribute
, NULL))
`payment_method`
: (id, user_id, payment_type:tinyint, details: json(encrypted, salt=password))
`payment_method`
: (id, user_id, payment_type:tinyint, details: json(encrypted, salt=password))
...
...
...
...