ALTER TABLE animals ADD COLUMN sterilization_status TEXT NOT NULL DEFAULT 'unknown'
  CHECK(sterilization_status IN ('unknown','no','yes'));
ALTER TABLE animals ADD COLUMN sterilization_date TEXT;
ALTER TABLE animals ADD COLUMN sterilization_vet_contact_id INTEGER REFERENCES directory_contacts(id) ON DELETE SET NULL;
ALTER TABLE animals ADD COLUMN sterilization_clinic_contact_id INTEGER REFERENCES directory_contacts(id) ON DELETE SET NULL;
UPDATE animals SET sterilization_status=CASE WHEN sterilized=1 THEN 'yes' ELSE 'unknown' END;
CREATE INDEX idx_animals_sterilization_status ON animals(sterilization_status);
