liding
3 天以前 c0cf736ff001bbaec59b7da6239f4670464952fd
main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql
@@ -1,31 +1,32 @@
-- 创建销售记录表
CREATE TABLE sales_record
(
    id                  BIGSERIAL PRIMARY KEY,                              -- 主键ID
    sale_date           DATE           NOT NULL,                            -- 销售日期
    customer_id         BIGINT,                                             -- 客户id
    customer            VARCHAR(255)   NOT NULL,                            -- 客户
    coal_id             VARCHAR(255)   NOT NULL,                            -- 煤种 id
    coal                VARCHAR(255)   NOT NULL,                            -- 煤种
    price_including_tax DECIMAL(10, 2) NOT NULL,                            -- 单价(含税)
    inventory_quantity  DECIMAL(10, 0) NOT NULL,                            -- 库存数量
    unit                VARCHAR(100)   NOT NULL,                            -- 单位
    sale_quantity       DECIMAL(10, 2) NOT NULL,                            -- 销售数量
    sale_price          DECIMAL(10, 2) NOT NULL,                            -- 销售单价 (含税)
    total_amount        DECIMAL(10, 2) NOT NULL,                            -- 销售总价 (含税)
    tax_coal            VARCHAR(36),                                        -- 购销煤税率13%
    tax_trans           VARCHAR(36),                                        -- 运输税率9%
    gross_profit        DECIMAL(10, 2),                                     -- 毛利润
    net_profit          DECIMAL(10, 2),                                     -- 净利润
    registrant_id       BIGINT,                                             -- 登记人id
    registrant          VARCHAR(255)   NOT NULL,                            -- 登记人
    registration_date   DATE           NOT NULL,                            -- 登记日期
    id                  BIGSERIAL PRIMARY KEY,            -- 主键ID
    sale_date           DATE           NOT NULL,          -- 销售日期
    customer_id         BIGINT,                           -- 客户id
    customer            VARCHAR(255)   NOT NULL,          -- 客户
    coal_id             VARCHAR(255)   NOT NULL,          -- 煤种 id
    coal                VARCHAR(255)   NOT NULL,          -- 煤种
    price_including_tax DECIMAL(10, 2) NOT NULL,          -- 单价(含税)
    inventory_quantity  DECIMAL(10, 0) NOT NULL,          -- 库存数量
    unit                VARCHAR(100)   NOT NULL,          -- 单位
    sale_quantity       DECIMAL(10, 2) NOT NULL,          -- 销售数量
    sale_price          DECIMAL(10, 2) NOT NULL,          -- 销售单价 (含税)
    total_amount        DECIMAL(10, 2) NOT NULL,          -- 销售总价 (含税)
    freight             DECIMAL(10, 2) NOT NULL,          -- 运费
    tax_coal            VARCHAR(36),                      -- 购销煤税率13%
    tax_trans           VARCHAR(36),                      -- 运输税率9%
    gross_profit        DECIMAL(10, 2),                   -- 毛利润
    net_profit          DECIMAL(10, 2),                   -- 净利润
    registrant_id       BIGINT,                           -- 登记人id
    registrant          VARCHAR(255)   NOT NULL,          -- 登记人
    registration_date   DATE           NOT NULL,          -- 登记日期
    create_time         TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 上传时间,默认当前时间
    update_time         TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 最后更新时间,默认当前时间
    create_by           VARCHAR(255),                                       -- 上传人用户名
    update_by           VARCHAR(255),                                       -- 最后修改人用户名
    deleted             INT            NOT NULL  DEFAULT 0                  -- 软删除标志:0=未删除,1=已删除
    create_time         TIMESTAMP WITHOUT TIME ZONE,          -- 上传时间,默认当前时间
    update_time         TIMESTAMP WITHOUT TIME ZONE,          -- 最后更新时间,默认当前时间
    create_by           VARCHAR(255),                     -- 上传人用户名
    update_by           VARCHAR(255),                     -- 最后修改人用户名
    deleted             INT            NOT NULL DEFAULT 0 -- 软删除标志:0=未删除,1=已删除
);
-- 表注释