-- MySQL Workbench Synchronization
-- Generated: 2018-05-04 15:43
-- Model: New Model
-- Version: 1.0
-- Project: Name of the project
-- Author: Steven Heath

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,ALLOW_INVALID_DATES';

CREATE TABLE IF NOT EXISTS `article_seo` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `news_article_id` INT(11) NOT NULL,
  `seo_data_id` INT(11) NOT NULL,
  PRIMARY KEY (`id`),
  INDEX `fk_article_seo_news_article1_idx` (`news_article_id` ASC),
  INDEX `fk_article_seo_seo_data2_idx` (`seo_data_id` ASC),
  CONSTRAINT `fk_article_seo_news_article1`
    FOREIGN KEY (`news_article_id`)
    REFERENCES `news_article` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_article_seo_seo_data2`
    FOREIGN KEY (`seo_data_id`)
    REFERENCES `seo_data` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

CREATE TABLE IF NOT EXISTS `event_seo` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `event_id` INT(11) NOT NULL,
  `seo_data_id` INT(11) NOT NULL,
  PRIMARY KEY (`id`),
  INDEX `fk_event_seo_event1_idx` (`event_id` ASC),
  INDEX `fk_event_seo_seo_data1_idx` (`seo_data_id` ASC),
  CONSTRAINT `fk_event_seo_event1`
    FOREIGN KEY (`event_id`)
    REFERENCES `event` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_event_seo_seo_data1`
    FOREIGN KEY (`seo_data_id`)
    REFERENCES `seo_data` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

CREATE TABLE IF NOT EXISTS `page_seo` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `page_id` INT(11) NOT NULL,
  `seo_data_id` INT(11) NOT NULL,
  PRIMARY KEY (`id`),
  INDEX `fk_page_seo_page1_idx` (`page_id` ASC),
  INDEX `fk_page_seo_seo_data2_idx` (`seo_data_id` ASC),
  CONSTRAINT `fk_page_seo_page1`
    FOREIGN KEY (`page_id`)
    REFERENCES `page` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_page_seo_seo_data2`
    FOREIGN KEY (`seo_data_id`)
    REFERENCES `seo_data` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

CREATE TABLE IF NOT EXISTS `seo_data` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `description` VARCHAR(200) NULL DEFAULT NULL,
  `cannonical_tag` VARCHAR(150) NULL DEFAULT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;


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