ALTER TABLE library_documents
ADD COLUMN cover_image_path VARCHAR(255) DEFAULT NULL,
ADD COLUMN publisher VARCHAR(255) DEFAULT NULL,
ADD COLUMN publish_year INT DEFAULT NULL,
ADD COLUMN country VARCHAR(100) DEFAULT NULL,
ADD COLUMN type_id INT UNSIGNED DEFAULT NULL,
ADD COLUMN page_count INT DEFAULT NULL,
ADD COLUMN summary_en TEXT DEFAULT NULL,
ADD COLUMN summary_ar TEXT DEFAULT NULL;

-- Add foreign key for type_id if library_types exists (it should from prev migration)
-- We use a safe procedure to add the FK only if the table exists to avoid strict dependency order failures in some setups,
-- but standard SQL is fine here assuming 004 ran.
-- However, strict SQL mode might complain if we don't index it.
ALTER TABLE library_documents ADD INDEX idx_library_type (type_id);
