Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/conference/database/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/conference/database/add_checkin_checkout_columns.sql

-- Add check-in and check-out timestamp columns to track attendance duration

-- Update event_registrations table
ALTER TABLE `event_registrations` 
ADD COLUMN `checked_in_at` timestamp NULL DEFAULT NULL,
ADD COLUMN `checked_out_at` timestamp NULL DEFAULT NULL;

-- Update nonmember_registrations table  
ALTER TABLE `nonmember_registrations`
ADD COLUMN `checked_in_at` timestamp NULL DEFAULT NULL,
ADD COLUMN `checked_out_at` timestamp NULL DEFAULT NULL;

-- Create attendance_logs table for detailed tracking
CREATE TABLE `attendance_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` int(11) NOT NULL,
  `user_id` int(11) NULL,
  `registration_code` varchar(50) NOT NULL,
  `registration_type` enum('member','nonmember') NOT NULL,
  `action` enum('check_in','check_out') NOT NULL,
  `action_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `duration_minutes` int(11) NULL,
  `ip_address` varchar(45),
  `user_agent` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_event_id` (`event_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_registration_code` (`registration_code`),
  KEY `idx_action_time` (`action_time`),
  CONSTRAINT `fk_attendance_logs_event` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_attendance_logs_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists