添加优惠券功能,实现价格计算
This commit is contained in:
@@ -819,4 +819,40 @@ comment on column bill.created_at is '创建时间';
|
||||
comment on column bill.updated_at is '更新时间';
|
||||
comment on column bill.deleted_at is '删除时间';
|
||||
|
||||
-- coupon 优惠券
|
||||
drop table if exists coupon cascade;
|
||||
create table coupon (
|
||||
id serial primary key,
|
||||
user_id int references "user" (id)
|
||||
on update cascade
|
||||
on delete cascade,
|
||||
code varchar(255) not null unique,
|
||||
remark varchar(255),
|
||||
amount decimal(12, 2) not null default 0,
|
||||
min_amount decimal(12, 2) not null default 0,
|
||||
status int not null default 0,
|
||||
expire_at timestamp,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
);
|
||||
create index coupon_user_id_index on coupon (user_id);
|
||||
create index coupon_code_index on coupon (code);
|
||||
create index coupon_status_index on coupon (status);
|
||||
create index coupon_deleted_at_index on coupon (deleted_at);
|
||||
|
||||
-- coupon表字段注释
|
||||
comment on table coupon is '优惠券表';
|
||||
comment on column coupon.id is '优惠券ID';
|
||||
comment on column coupon.user_id is '用户ID';
|
||||
comment on column coupon.code is '优惠券代码';
|
||||
comment on column coupon.remark is '优惠券备注';
|
||||
comment on column coupon.amount is '优惠券金额';
|
||||
comment on column coupon.min_amount is '最低消费金额';
|
||||
comment on column coupon.status is '优惠券状态:0-未使用,1-已使用,2-已过期';
|
||||
comment on column coupon.expire_at is '过期时间';
|
||||
comment on column coupon.created_at is '创建时间';
|
||||
comment on column coupon.updated_at is '更新时间';
|
||||
comment on column coupon.deleted_at is '删除时间';
|
||||
|
||||
-- endregion
|
||||
Reference in New Issue
Block a user