DROP TABLE IF EXISTS output_inventory_record; -- 创建出库记录表 CREATE TABLE output_inventory_record ( id BIGSERIAL PRIMARY KEY, -- 主键ID inventory_id bigint not null default 0, inventory_type varchar(10) not null default '', quantity DECIMAL(10, 2) not null default 0, deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 create_by VARCHAR(255), -- 创建人用户名 create_time TIMESTAMP WITHOUT TIME ZONE -- 创建时间,默认当前时间 ); -- 创建索引 create index index_inventory_id_and_inventory_type_and_quantity_for_output_inventory_record on output_inventory_record (inventory_id, inventory_type, quantity); -- 添加表注释 COMMENT ON TABLE output_inventory_record IS '出库记录表'; -- 添加字段注释 COMMENT ON COLUMN output_inventory_record.id IS '主键ID'; COMMENT ON COLUMN output_inventory_record.inventory_id IS '库id'; COMMENT ON COLUMN output_inventory_record.inventory_type IS '库类型'; COMMENT ON COLUMN output_inventory_record.quantity IS '记录数量'; COMMENT ON COLUMN output_inventory_record.deleted IS '软删除标志,0=未删除,1=已删除'; COMMENT ON COLUMN output_inventory_record.create_by IS '创建该记录的用户'; COMMENT ON COLUMN output_inventory_record.create_time IS '记录创建时间';