-- 清理废弃的分佣相关表
-- 这些表从未在生产环境使用，可以直接删除

-- 删除废弃表
DROP TABLE IF EXISTS tb_agent_hierarchy;
DROP TABLE IF EXISTS tb_commission_rule;
DROP TABLE IF EXISTS tb_commission_ladder;
DROP TABLE IF EXISTS tb_commission_combined_condition;
DROP TABLE IF EXISTS tb_commission_approval;
DROP TABLE IF EXISTS tb_commission_template;
DROP TABLE IF EXISTS tb_carrier_settlement;
DROP TABLE IF EXISTS tb_agent_package_allocation;

-- 为 tb_package 表添加新字段
ALTER TABLE tb_package ADD COLUMN IF NOT EXISTS suggested_cost_price BIGINT DEFAULT 0;
ALTER TABLE tb_package ADD COLUMN IF NOT EXISTS suggested_retail_price BIGINT DEFAULT 0;
ALTER TABLE tb_package ADD COLUMN IF NOT EXISTS shelf_status INT DEFAULT 2 NOT NULL;

COMMENT ON COLUMN tb_package.suggested_cost_price IS '建议成本价(分为单位)';
COMMENT ON COLUMN tb_package.suggested_retail_price IS '建议售价(分为单位)';
COMMENT ON COLUMN tb_package.shelf_status IS '上架状态 1-上架 2-下架';
