-- 创建 License 授权表
CREATE TABLE IF NOT EXISTS domain_monitor.super_admin_license (
    id SERIAL PRIMARY KEY,
    super_admin_id INTEGER NOT NULL,
    license_key VARCHAR(200) NOT NULL,
    expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
    status VARCHAR(20) NOT NULL DEFAULT 'active',
    max_tenants INTEGER,
    max_users_per_tenant INTEGER,
    remark TEXT,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    updated_at TIMESTAMP WITH TIME ZONE
);

CREATE INDEX idx_sa_license_sa_id ON domain_monitor.super_admin_license(super_admin_id);
CREATE INDEX idx_sa_license_status ON domain_monitor.super_admin_license(status);
CREATE INDEX idx_sa_license_expires ON domain_monitor.super_admin_license(expires_at);
