-- Migration 010: Add bulk operations tracking
-- Creates bulk_operations table for admin bulk actions

CREATE TABLE bulk_operations (
    operation_id INT AUTO_INCREMENT PRIMARY KEY,
    operation_type VARCHAR(50) NOT NULL,
    ticket_ids TEXT NOT NULL, -- Comma-separated
    performed_by INT NOT NULL,
    parameters JSON,
    status VARCHAR(20) DEFAULT 'pending',
    total_tickets INT,
    processed_tickets INT DEFAULT 0,
    failed_tickets INT DEFAULT 0,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    completed_at TIMESTAMP NULL,
    FOREIGN KEY (performed_by) REFERENCES users(user_id),
    INDEX idx_performed_by (performed_by),
    INDEX idx_created_at (created_at)
);
