-- 创建设备清单表
CREATE TABLE IF NOT EXISTS device_inventory (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    computer_name VARCHAR(255) DEFAULT '',
    ip_address VARCHAR(64) DEFAULT '',
    mac_address VARCHAR(64) DEFAULT '',
    employee_account VARCHAR(128) DEFAULT '',
    employee_name VARCHAR(128) DEFAULT '',
    department VARCHAR(255) DEFAULT '',
    source VARCHAR(32) DEFAULT '',
    asset_tag VARCHAR(64) DEFAULT '',
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- 创建索引加速查询
CREATE INDEX IF NOT EXISTS idx_device_employee ON device_inventory(employee_account);
CREATE INDEX IF NOT EXISTS idx_device_ip ON device_inventory(ip_address);
CREATE INDEX IF NOT EXISTS idx_device_mac ON device_inventory(mac_address);
CREATE INDEX IF NOT EXISTS idx_device_source ON device_inventory(source);
