-- MySQL Workbench Synchronization
-- Generated: 2019-10-14 12:33
-- Model: SoG
-- Version: 1.3.25
-- Project: GLam
-- Author: JaX

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

ALTER TABLE `sog`.`glam_his_access_point` 
CHANGE COLUMN `his_action` `his_action` ENUM('ADDED', 'UPDATED', 'DELETED', 'LOCK_REPLACED', 'LATCH_REPLACED', 'VALIDATED', 'RESTORED', 'CLEARED_UNSAFE') NULL DEFAULT NULL ;

ALTER TABLE `sog`.`glam_device` 
ADD COLUMN `device_certificate` VARCHAR(32) NULL DEFAULT NULL AFTER `asset_id`;

-- -----------------------------------------------------
-- Data for table `sog`.`krf_user`
-- -----------------------------------------------------
START TRANSACTION;
USE `sog`;

INSERT INTO `sog`.`krf_user` (`usr_id`, `usr_username`, `usr_password`, `usr_firstname`, `usr_lastname`, `usr_contact_cell_no`, `usr_contact_work_no`, `usr_contact_email`, `usr_employee_no`, `usr_is_active`, `usr_system_role`, `usr_last_login`, `usr_api_key`, `usr_timezone_id`, `is_deleted`, `last_changed_by`, `last_changed_on`, `version`) VALUES ('33de378e-2d31-4245-807c-3fad243546f6', 'glam_iotd', '7B872EE19B90E1159EE16299C0EB2FC8', 'Glam_IoT', 'Glam_IoT', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL);

COMMIT;

-- -----------------------------------------------------
-- Add GLAM_IOT
-- -----------------------------------------------------
START TRANSACTION;
USE `sog`;

INSERT INTO `sog`.`krf_application_role` (`app_role_id`, `app_id`, `app_role_name`) VALUES ('c426311d-8c93-420f-8cb8-170c5bcdcfa8', 'dfcc552b-62ef-11e2-a2e9-e8039a3b0793', 'GLAM_IOT');

COMMIT;

-- -----------------------------------------------------
-- Assign GLAM_NOC and GLAM_IOT
-- -----------------------------------------------------
START TRANSACTION;
USE `sog`;

INSERT INTO `sog`.`krf_user_application` (`app_id`, `usr_id`, `app_role_id`, `last_changed_by`, `last_changed_on`, `version`, `is_deleted`) VALUES ('dfcc552b-62ef-11e2-a2e9-e8039a3b0793', '33de378e-2d31-4245-807c-3fad243546f6', '21251efa-62f0-11e2-a2e9-e8039a3b0793', NULL, NULL, NULL, NULL);

COMMIT;
START TRANSACTION;
USE `sog`;

INSERT INTO `sog`.`krf_user_application` (`app_id`, `usr_id`, `app_role_id`, `last_changed_by`, `last_changed_on`, `version`, `is_deleted`) VALUES ('dfcc552b-62ef-11e2-a2e9-e8039a3b0793', '33de378e-2d31-4245-807c-3fad243546f6', 'c426311d-8c93-420f-8cb8-170c5bcdcfa8', NULL, NULL, NULL, NULL);

COMMIT;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
