CREATE TABLE training_registrations (
    id CHAR(36) PRIMARY KEY,
    training_session_id CHAR(36) NOT NULL,
    customer_id CHAR(36) NOT NULL,
    registered_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (training_session_id) REFERENCES training_sessions(id) ON DELETE CASCADE,
    FOREIGN KEY (customer_id) REFERENCES customers(id) ON DELETE CASCADE,
    INDEX idx_training_session_id (training_session_id),
    INDEX idx_customer_id (customer_id),
    UNIQUE KEY unique_registration (training_session_id, customer_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
