-- Migration 009: Add Microsoft Azure and Meta/Facebook public lists
-- Date: 2026-01-02

-- Microsoft Azure IP ranges (whitelist - cloud provider)
INSERT INTO public_lists (name, url, type, enabled, fetch_interval_minutes)
SELECT 'Microsoft Azure',
       'https://raw.githubusercontent.com/femueller/cloud-ip-ranges/master/microsoft-azure-ip-ranges.json',
       'whitelist', true, 60
WHERE NOT EXISTS (SELECT 1 FROM public_lists WHERE name = 'Microsoft Azure');

-- Meta/Facebook IP ranges (whitelist - major service provider)
INSERT INTO public_lists (name, url, type, enabled, fetch_interval_minutes)
SELECT 'Meta (Facebook)',
       'https://raw.githubusercontent.com/parseword/util-misc/master/block-facebook/facebook-ip-ranges.txt',
       'whitelist', true, 60
WHERE NOT EXISTS (SELECT 1 FROM public_lists WHERE name = 'Meta (Facebook)');

-- Update schema version
UPDATE schema_version SET version = 9;

-- Verify insertion
SELECT id, name, type, enabled, url FROM public_lists WHERE name IN ('Microsoft Azure', 'Meta (Facebook)');
