-- Migration 012: Add cage_uuid to kandangs table -- Add cage_uuid field for external scales API integration -- Add cage_uuid column (nullable, unique) ALTER TABLE kandangs ADD COLUMN IF NOT EXISTS cage_uuid VARCHAR(36) UNIQUE; -- Add comment explaining the field COMMENT ON COLUMN kandangs.cage_uuid IS 'External cage UUID for scales API (dashboard.cpsp.id/api/scales/cage/)'; -- Seed initial data for existing kandangs -- Kandang Atas gets the existing hardcoded UUID UPDATE kandangs SET cage_uuid = '9f556d2a-af5c-41b0-bcd0-6cea0dfa0fed' WHERE LOWER(name) LIKE '%atas%'; -- Kandang Bawah and others remain null (to be configured via settings UI) -- This is intentional - admins will configure via IoT Panel settings