-- MySQL Workbench Synchronization
-- Generated: 2020-03-30 13:13
-- Model: SoG
-- Version: 1.3.27
-- 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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- -----------------------------------------------------
-- Add TAG_MANAGEMENT
-- -----------------------------------------------------
START TRANSACTION;

USE `sog`;

INSERT INTO `sog`.`krf_application_role` (`app_role_id`, `app_id`, `app_role_name`) VALUES ('6872d30d-f464-4c9b-991e-382a1c11a9cb', 'dfcc552b-62ef-11e2-a2e9-e8039a3b0793', 'TAG_MANAGEMENT');

COMMIT;


-- -----------------------------------------------------
-- Add TAG_MANAGEMENT role to all GLAM_NOC users
-- -----------------------------------------------------
START TRANSACTION;

USE `sog`;

INSERT INTO sog.krf_user_application (app_id, usr_id, app_role_id)
	SELECT "dfcc552b-62ef-11e2-a2e9-e8039a3b0793", usr_id, "6872d30d-f464-4c9b-991e-382a1c11a9cb" FROM sog.krf_user_application 
    WHERE app_role_id = "21251efa-62f0-11e2-a2e9-e8039a3b0793";

COMMIT;


ALTER TABLE `sog`.`glam_system_details` 
ADD COLUMN `system_multilock_select` TINYINT(1) NULL DEFAULT 1 AFTER `system_schedule_field_b`;

ALTER TABLE `sog`.`glam_objholder` ADD COLUMN `auto_approvable` BIT(1) NULL DEFAULT b'0' AFTER `version`;
ALTER TABLE `sog`.`glam_systemuser` ADD COLUMN `auto_approvable` BIT(1) NULL DEFAULT b'0' AFTER `last_changed_by`;

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