-- Add node_data column to project_nodes table
-- This column stores the complete node.data object to preserve catalog component metadata

USE gchain_db;

-- Add the column
ALTER TABLE project_nodes
ADD COLUMN node_data JSON NULL
AFTER parameters;

-- Verify the column was added
DESCRIBE project_nodes;

-- Show sample of existing data
SELECT id, project_id, node_id, component_name,
       CASE WHEN parameters IS NOT NULL THEN 'HAS DATA' ELSE 'NULL' END as has_parameters,
       CASE WHEN node_data IS NOT NULL THEN 'HAS DATA' ELSE 'NULL' END as has_node_data
FROM project_nodes
LIMIT 5;
