-- ============================================================
-- 监控大屏 - 超级管理员模型折扣表
-- 文件: 002_super_admin_model_discount.sql
-- 日期: 2026-05-12
--
-- 超管折扣存储在 super_admin_model_discount 表中，通过爬虫同步服务自动更新：
-- - 全局折扣：model_code = "*"
-- - 模型级折扣：model_code = 具体模型标识
-- - 优先匹配具体模型，无匹配则使用全局折扣 "*"
-- ============================================================

-- 超级管理员模型折扣表
CREATE TABLE IF NOT EXISTS domain_monitor.super_admin_model_discount (
    id SERIAL PRIMARY KEY,
    model_code VARCHAR NOT NULL,
    discount_rate NUMERIC(10, 4) NOT NULL DEFAULT 1.0000,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

CREATE UNIQUE INDEX IF NOT EXISTS ix_samd_model_code ON domain_monitor.super_admin_model_discount (model_code);
