Files
yichayilu_boot/doc/sql/createtable/wheel_prize_postgres.sql
2026-02-03 20:46:49 +08:00

80 lines
3.5 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE prize_spu
(
id int8 NOT NULL PRIMARY KEY,
spu_name VARCHAR(255) DEFAULT '' NOT NULL,
main_img VARCHAR(255) DEFAULT '' NOT NULL,
detail_img text NULL,
cost_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
spu_qty INTEGER DEFAULT 0 NOT NULL,
status INTEGER DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP(6) NULL,
update_user int8 NULL,
update_time TIMESTAMP(6) NULL,
is_deleted INTEGER DEFAULT 0 NULL
);
COMMENT ON TABLE prize_spu IS '奖池商品';
COMMENT ON COLUMN prize_spu.id IS '主键';
COMMENT ON COLUMN prize_spu.spu_name IS '商品名称';
COMMENT ON COLUMN prize_spu.main_img IS '主图';
COMMENT ON COLUMN prize_spu.detail_img IS '详情图(多图,逗号分割)';
COMMENT ON COLUMN prize_spu.cost_price IS '成本价';
COMMENT ON COLUMN prize_spu.original_price IS '原价';
COMMENT ON COLUMN prize_spu.spu_qty IS '库存';
COMMENT ON COLUMN prize_spu.status IS '状态(0=下架,1=上架,3=删除)';
COMMENT ON COLUMN prize_spu.create_user IS '创建人';
COMMENT ON COLUMN prize_spu.create_dept IS '创建部门';
COMMENT ON COLUMN prize_spu.create_time IS '创建时间';
COMMENT ON COLUMN prize_spu.update_user IS '修改人';
COMMENT ON COLUMN prize_spu.update_time IS '修改时间';
COMMENT ON COLUMN prize_spu.is_deleted IS '是否已删除';
CREATE TABLE prize_spu_order
(
id int8 NOT NULL PRIMARY KEY,
user_id int8 DEFAULT 0 NOT NULL,
user_name VARCHAR(128) NULL,
user_phone int8 NULL,
spu_id int8 NULL,
spu_name VARCHAR(255) NULL,
main_img VARCHAR(255) NULL,
detail_img text NULL,
quantity INTEGER DEFAULT 0 NOT NULL,
order_status INTEGER DEFAULT 0 NOT NULL,
version int8 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP(6) NULL,
update_user int8 NULL,
update_time TIMESTAMP(6) NULL,
status INTEGER DEFAULT -1 NULL,
is_deleted INTEGER DEFAULT 0 NULL
);
create index prize_spu_order_index on prize_spu_order (user_id);
COMMENT ON TABLE prize_spu_order IS '奖池商品订单';
comment on column prize_spu_order.id is '主键';
comment on column prize_spu_order.user_id is '用户ID';
comment on column prize_spu_order.user_name is '用户名称';
comment on column prize_spu_order.user_phone is '用户手机号';
comment on column prize_spu_order.spu_id is '商品ID';
comment on column prize_spu_order.spu_name is '商品名称';
comment on column prize_spu_order.main_img is '商品主图';
comment on column prize_spu_order.detail_img is '商品详情图(多图,逗号分割)';
comment on column prize_spu_order.quantity is '商品数量';
comment on column prize_spu_order.order_status is '订单状态(0=待发货,1=已发货,2=已完成,3=已取消)';
comment on column prize_spu_order.version is '版本号';
comment on column prize_spu_order.create_user is '创建人';
comment on column prize_spu_order.create_dept is '创建部门';
comment on column prize_spu_order.create_time is '创建时间';
comment on column prize_spu_order.update_user is '修改人';
comment on column prize_spu_order.update_time is '修改时间';
comment on column prize_spu_order.status is '状态(-1=无效,0=有效)';
comment on column prize_spu_order.is_deleted is '是否已删除';