From c02d843dbc3c28d0f530f3141e39e6abef30adf5 Mon Sep 17 00:00:00 2001 From: luorijun Date: Tue, 8 Apr 2025 14:54:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20sql=20=E9=81=97=E7=95=99?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/sql/init.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/sql/init.sql b/scripts/sql/init.sql index c53e667..d01cd2d 100644 --- a/scripts/sql/init.sql +++ b/scripts/sql/init.sql @@ -618,8 +618,8 @@ create table resource_pss ( on delete cascade, type int, live int, - quota int, expire timestamp, + quota int, used int not null default 0, daily_limit int not null default 0, daily_used int not null default 0, @@ -748,7 +748,7 @@ comment on column trade.deleted_at is '删除时间'; drop table if exists bill cascade; create table bill ( id serial primary key, - order_id int not null references trade (id) + trade_id int not null references trade (id) on update cascade on delete cascade, user_id int not null references "user" (id) @@ -766,14 +766,14 @@ create table bill ( updated_at timestamp default current_timestamp, deleted_at timestamp ); -create index bill_order_id_index on bill (order_id); +create index bill_trade_id_index on bill (trade_id); create index bill_product_id_index on bill (product_id); create index bill_deleted_at_index on bill (deleted_at); -- bill表字段注释 comment on table bill is '账单表'; comment on column bill.id is '账单ID'; -comment on column bill.order_id is '订单ID'; +comment on column bill.trade_id is '订单ID'; comment on column bill.user_id is '用户ID'; comment on column bill.product_id is '产品ID'; comment on column bill.info is '产品可读信息'; @@ -789,7 +789,7 @@ comment on column bill.deleted_at is '删除时间'; drop table if exists refund cascade; create table refund ( id serial primary key, - order_id int not null references trade (id) + trade_id int not null references trade (id) on update cascade on delete cascade, product_id int references product (id) -- @@ -800,14 +800,14 @@ create table refund ( updated_at timestamp default current_timestamp, deleted_at timestamp ); -create index refund_order_id_index on refund (order_id); +create index refund_trade_id_index on refund (trade_id); create index refund_product_id_index on refund (product_id); create index refund_deleted_at_index on refund (deleted_at); -- refund表字段注释 comment on table refund is '退款记录表'; comment on column refund.id is '退款ID'; -comment on column refund.order_id is '订单ID'; +comment on column refund.trade_id is '订单ID'; comment on column refund.product_id is '产品ID'; comment on column refund.amount is '退款金额'; comment on column refund.created_at is '创建时间';