-- MySQL Workbench Synchronization
-- Generated: 2017-03-27 09:09
-- Model: SoG
-- Version: 1.3.15
-- 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_keyholder_group` 
CHANGE COLUMN `group_name` `group_name` VARCHAR(64) CHARACTER SET 'utf8' NULL DEFAULT NULL ,
CHANGE COLUMN `group_description` `group_description` VARCHAR(200) CHARACTER SET 'utf8' NULL DEFAULT NULL ;

ALTER TABLE `sog`.`versioning` 
CHANGE COLUMN `version_string` `version_string` VARCHAR(10) CHARACTER SET 'utf8' NULL DEFAULT NULL ;

CREATE TABLE IF NOT EXISTS `sog`.`glam_site` (
  `site_id` CHAR(36) NOT NULL,
  `site_name` VARCHAR(64) NOT NULL,
  `site_description` VARCHAR(128) NULL DEFAULT NULL,
  `site_code` VARCHAR(64) NULL DEFAULT NULL,
  `site_address` VARCHAR(128) NULL DEFAULT NULL,
  `is_deleted` BIT(1) NULL DEFAULT b'0',
  `site_coordinates` POINT NULL DEFAULT NULL,
  `last_changed_by` CHAR(36) NULL DEFAULT NULL,
  `last_changed_on` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`site_id`),
  UNIQUE INDEX `site_name_UNIQUE` (`site_name` ASC))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;

CREATE TABLE IF NOT EXISTS `sog`.`glam_site_access_point` (
  `site_id` CHAR(36) NOT NULL,
  `access_point_id` CHAR(36) NOT NULL,
  INDEX `fk_glam_site_access_point_glam_site1_idx` (`site_id` ASC),
  INDEX `fk_glam_site_access_point_glam_access_point1_idx` (`access_point_id` ASC),
  CONSTRAINT `fk_glam_site_access_point_glam_site1`
    FOREIGN KEY (`site_id`)
    REFERENCES `sog`.`glam_site` (`site_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_glam_site_access_point_glam_access_point1`
    FOREIGN KEY (`access_point_id`)
    REFERENCES `sog`.`glam_access_point` (`access_point_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


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