CREATE TABLE `user_authentication` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `user_type` enum('STAFF','STUDENT','ADMIN','PARENT') NOT NULL,
  `secret` varchar(256) NOT NULL,
  `is_enabled` int(11) NOT NULL DEFAULT '1',
  `last_key_generated_timestamp` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `un_uid_utype_secret` (`user_id`,`user_type`,`secret`),
  KEY `in_is_enabled_index` (`is_enabled`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;


ALTER TABLE `user_authentication` 
ADD COLUMN `created_by` INT NULL AFTER `last_key_generated_timestamp`,
ADD COLUMN `created_date` DATETIME NULL AFTER `created_by`,
ADD COLUMN `updated_by` INT NULL AFTER `created_date`,
ADD COLUMN `updated_date` DATETIME NULL AFTER `updated_by`;
