-- Add sort_order column for tree ordering
ALTER TABLE entries ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0;
CREATE INDEX IF NOT EXISTS idx_entries_parent_sort ON entries(parent_id, sort_order) WHERE deleted_at IS NULL;
