-- Migration: Add created_by to ai_document_files table
-- Date: 2025-01-XX
-- Description: Adds created_by column to track which user created the AI document file for notification purposes

-- ===== Add created_by column to ai_document_files table =====
ALTER TABLE ai_document_files
ADD COLUMN created_by VARCHAR(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '作成者ユーザーID（通知送信用）',
ADD INDEX idx_created_by (created_by);

-- Add foreign key constraint
ALTER TABLE ai_document_files
ADD CONSTRAINT fk_ai_document_files_created_by FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE SET NULL;

