-- Update v9: voucher delete/disable, throttled MikroTik sync, and search/tracking
ALTER TABLE vouchers
    MODIFY status ENUM('available','sold','used','expired','cancelled','disabled') NOT NULL DEFAULT 'available';

ALTER TABLE vouchers
    ADD COLUMN IF NOT EXISTS mikrotik_last_status VARCHAR(80) NULL AFTER mikrotik_sync_message,
    ADD COLUMN IF NOT EXISTS last_checked_at DATETIME NULL AFTER mikrotik_last_status;

CREATE INDEX IF NOT EXISTS idx_vouchers_last_checked ON vouchers (last_checked_at);
