create table t_transaction (
id bigint not null comment '主键,采用 SnowFlake 算法生成',
user_id bigint not null comment '用户编号',
product_id bigint not null comment '商品编号',
payment_channel tinyint not null comment '交易渠道,字典:1-银行卡,2-微信支付,3-支付宝支付,4-其他支付',
amount decimal(10,2) not null comment '交易金额',
quantity int not null default 1 comment '交易商品数量',
discount decimal(10,2) not null default 0 comment '优惠金额',
trans_date timestamp not null comment '交易日期',
note varchar(512) comment '备注',
primary key (id)
);
参考《Spring Cloud 微服务和分布式系统实践》,作者杨开振