-- Add GitHub integrations support to profiles
-- This stores GitHub repository integrations per book
-- Add github_integrations column to profiles table
ALTER TABLE profiles
ADD COLUMN IF NOT EXISTS github_integrations JSONB DEFAULT '{}'::jsonb;
-- Create index for GitHub integrations queries
CREATE INDEX IF NOT EXISTS idx_profiles_github_integrations
ON profiles USING gin (github_integrations);
-- Add comment for documentation
COMMENT ON COLUMN profiles.github_integrations IS 'JSON object storing GitHub repository integrations per book ID. Format: {"book_id": {"accessToken": "...", "repoOwner": "...", "repoName": "...", "connectedAt": "..."}}';