-- Migration 004: redirect chain tracking + image file size
ALTER TABLE crawl_pages
    ADD COLUMN IF NOT EXISTS redirect_url VARCHAR(2048) NULL DEFAULT NULL COMMENT 'Final redirect destination if status is 3xx',
    ADD COLUMN IF NOT EXISTS redirect_chain_length TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Number of hops in redirect chain';

ALTER TABLE crawl_images
    ADD COLUMN IF NOT EXISTS file_size INT UNSIGNED NULL DEFAULT NULL COMMENT 'Image file size in bytes (captured via Content-Length header)',
    ADD COLUMN IF NOT EXISTS width_attr SMALLINT UNSIGNED NULL DEFAULT NULL COMMENT 'HTML width attribute value',
    ADD COLUMN IF NOT EXISTS height_attr SMALLINT UNSIGNED NULL DEFAULT NULL COMMENT 'HTML height attribute value';
