-- Migration: extend payments table for Paystack/Square and appointment payments

ALTER TABLE `payments`
  MODIFY `payment_type` ENUM('course_enrollment','certificate','subscription','appointment','other') NOT NULL DEFAULT 'course_enrollment',
  MODIFY `payment_method` ENUM('stripe','paypal','bank_transfer','mobile_money','free','paystack','square') NOT NULL;

ALTER TABLE `payments`
  ADD COLUMN `appointment_id` INT(11) DEFAULT NULL AFTER `enrollment_id`;

ALTER TABLE `payments`
  ADD CONSTRAINT `fk_payments_appointment_id` FOREIGN KEY (`appointment_id`) REFERENCES `appointments`(`id`) ON DELETE SET NULL;
