-- Add mission column to employees table if it doesn't exist

-- Add mission if it does not exist
SET @sql = (SELECT IF(
    (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() AND table_name = 'employees' AND column_name = 'mission') = 0,
    'ALTER TABLE `employees` ADD COLUMN `mission` text AFTER `remarks`;',
    'SELECT ''Column mission already exists'';'
));
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

