-- =============================================================================
-- Migration 031: Add thumbnail_id to posts table
-- Table: posts
-- Purpose: Add thumbnail_id column to reference files table for post thumbnails
-- Depends on: 023-add-posts-and-post_targets.sql (posts table), 002-file-schema.sql (files table)
-- =============================================================================

BEGIN;

-- Add thumbnail_id column to posts table
ALTER TABLE posts
ADD COLUMN IF NOT EXISTS thumbnail_id UUID REFERENCES files(id) ON DELETE SET NULL;

COMMIT;
