DROP TABLE IF EXISTS coal_lock;

-- 创建锁仓表
CREATE TABLE coal_lock
(
    id                 int4 PRIMARY KEY,          -- id
    lock_code          varchar(255),              -- 锁仓编号
    coal_name          varchar(255),              -- 煤种名称
    supplier_name      varchar(255),              -- 供应商
    total_inventory    varchar(255),              -- 总库存量(吨)
    lock_quantity      varchar(255),              -- 锁仓数量(吨)
    available_quantity varchar(255),              -- 可用数量(吨)
    lock_status        varchar(255),              -- 锁仓状态
    lock_reason        varchar(255),              -- 锁仓原因
    lock_user          varchar(255),              -- 锁仓人
    lock_time          varchar(255),              -- 锁仓时间
    expected_unlock_time varchar(255),           -- 解锁时间
    remarks            varchar(255),              -- 备注
    create_by          varchar(255),              -- 创建者
    create_time        timestamp(6),              -- 创建时间
    update_by          varchar(255),              -- 修改者
    update_time        timestamp(6),              -- 修改时间
    deleted            int4                        -- 逻辑删除
);

-- 添加表注释
COMMENT ON TABLE coal_lock IS '锁仓表';

-- 添加字段注释
COMMENT ON COLUMN coal_lock.id IS 'id';
COMMENT ON COLUMN coal_lock.lock_code IS '锁仓编号';
COMMENT ON COLUMN coal_lock.coal_name IS '煤种名称';
COMMENT ON COLUMN coal_lock.supplier_name IS '供应商';
COMMENT ON COLUMN coal_lock.total_inventory IS '总库存量(吨)';
COMMENT ON COLUMN coal_lock.lock_quantity IS '锁仓数量(吨)';
COMMENT ON COLUMN coal_lock.available_quantity IS '可用数量(吨)';
COMMENT ON COLUMN coal_lock.lock_status IS '锁仓状态';
COMMENT ON COLUMN coal_lock.lock_reason IS '锁仓原因';
COMMENT ON COLUMN coal_lock.lock_user IS '锁仓人';
COMMENT ON COLUMN coal_lock.lock_time IS '锁仓时间';
COMMENT ON COLUMN coal_lock.expected_unlock_time IS '解锁时间';
COMMENT ON COLUMN coal_lock.remarks IS '备注';
COMMENT ON COLUMN coal_lock.create_by IS '创建者';
COMMENT ON COLUMN coal_lock.create_time IS '创建时间';
COMMENT ON COLUMN coal_lock.update_by IS '修改者';
COMMENT ON COLUMN coal_lock.update_time IS '修改时间';
COMMENT ON COLUMN coal_lock.deleted IS '逻辑删除';