-- Migration: Add browser storage columns to browser_sessions table
-- This migration adds columns for storing LocalStorage and SessionStorage data

-- Add local_storage column
ALTER TABLE browser_sessions ADD COLUMN local_storage TEXT;

-- Add session_storage column  
ALTER TABLE browser_sessions ADD COLUMN session_storage TEXT;

-- Add consent_data column for tracking cookie consent status
ALTER TABLE browser_sessions ADD COLUMN consent_data TEXT;

-- Add storage_updated_at to track when storage was last updated
ALTER TABLE browser_sessions ADD COLUMN storage_updated_at DATETIME;

-- Update existing sessions to have NULL storage (backward compatibility)
UPDATE browser_sessions 
SET storage_updated_at = updated_at 
WHERE storage_updated_at IS NULL;