-- Add pillar column to servers table
ALTER TABLE servers ADD COLUMN IF NOT EXISTS pillar TEXT DEFAULT 'worker';

-- Populate existing pillars based on template names
UPDATE servers SET pillar = 'controlproxy' WHERE template = 'control-plane-node';
UPDATE servers SET pillar = 'worker' WHERE template = 'worker-node';
UPDATE servers SET pillar = 'database' WHERE template = 'db-node';
UPDATE servers SET pillar = 'system' WHERE template = 'monitoring-node';
UPDATE servers SET pillar = 'mixed' WHERE template IN ('worker-db-combo', 'worker-monitor-combo');
UPDATE servers SET pillar = 'unified' WHERE template = 'all-in-one';
