-- Adminer 4.0.3 MySQL dump

SET NAMES utf8;
SET foreign_key_checks = 0;
SET time_zone = '+01:00';
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

DROP TABLE IF EXISTS `galleries`;
CREATE TABLE `galleries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `group` varchar(255) DEFAULT NULL,
  `order` int(11) DEFAULT NULL,
  `mainphoto` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `mainphoto` (`mainphoto`),
  CONSTRAINT `galleries_ibfk_1` FOREIGN KEY (`mainphoto`) REFERENCES `photos` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `galleries_descriptions`;
CREATE TABLE `galleries_descriptions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `gallery` int(11) NOT NULL,
  `language` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `gallery_language` (`gallery`,`language`),
  KEY `language` (`language`),
  CONSTRAINT `galleries_descriptions_ibfk_1` FOREIGN KEY (`gallery`) REFERENCES `galleries` (`id`) ON DELETE CASCADE,
  CONSTRAINT `galleries_descriptions_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `galleries_photos`;
CREATE TABLE `galleries_photos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `gallery` int(11) NOT NULL,
  `photo` int(11) NOT NULL,
  `order` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `gallery_photo` (`gallery`,`photo`),
  KEY `gallery` (`gallery`),
  KEY `photo` (`photo`),
  CONSTRAINT `galleries_photos_ibfk_1` FOREIGN KEY (`gallery`) REFERENCES `galleries` (`id`) ON DELETE CASCADE,
  CONSTRAINT `galleries_photos_ibfk_2` FOREIGN KEY (`photo`) REFERENCES `photos` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `photos`;
CREATE TABLE `photos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `file` char(40) COLLATE latin1_general_ci NOT NULL,
  `old_file` varchar(255) COLLATE latin1_general_ci NOT NULL,
  `width` smallint(6) NOT NULL,
  `height` smallint(6) NOT NULL,
  `center_x` smallint(6) DEFAULT NULL,
  `center_y` smallint(6) DEFAULT NULL,
  `video` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `file` (`file`),
  UNIQUE KEY `old_file` (`old_file`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


DROP TABLE IF EXISTS `photos_descriptions`;
CREATE TABLE `photos_descriptions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `photo` int(11) NOT NULL,
  `language` int(11) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `long_description` text,
  PRIMARY KEY (`id`),
  UNIQUE KEY `language_photo` (`language`,`photo`),
  KEY `photo` (`photo`),
  CONSTRAINT `photos_descriptions_ibfk_1` FOREIGN KEY (`photo`) REFERENCES `photos` (`id`) ON DELETE CASCADE,
  CONSTRAINT `photos_descriptions_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `photos_hotspots`;
CREATE TABLE `photos_hotspots` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `photo` int(11) NOT NULL,
  `x` mediumint(9) NOT NULL,
  `y` mediumint(9) NOT NULL,
  `videos` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  `icon` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `photo` (`photo`),
  KEY `category` (`icon`),
  CONSTRAINT `photos_hotspots_ibfk_2` FOREIGN KEY (`photo`) REFERENCES `photos` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `photos_hotspots_contents`;
CREATE TABLE `photos_hotspots_contents` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `hotspot` int(11) NOT NULL,
  `language` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `text` text,
  `url` text,
  PRIMARY KEY (`id`),
  UNIQUE KEY `language_hotspot` (`language`,`hotspot`),
  KEY `hotspot` (`hotspot`),
  CONSTRAINT `photos_hotspots_contents_ibfk_1` FOREIGN KEY (`hotspot`) REFERENCES `photos_hotspots` (`id`) ON DELETE CASCADE,
  CONSTRAINT `photos_hotspots_contents_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `photos_hotspots_photos`;
CREATE TABLE `photos_hotspots_photos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `hotspot` int(11) NOT NULL,
  `photo` int(11) NOT NULL,
  `order` mediumint(9) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `hotspot_photo` (`hotspot`,`photo`),
  KEY `photo` (`photo`),
  CONSTRAINT `photos_hotspots_photos_ibfk_1` FOREIGN KEY (`hotspot`) REFERENCES `photos_hotspots` (`id`) ON DELETE CASCADE,
  CONSTRAINT `photos_hotspots_photos_ibfk_2` FOREIGN KEY (`photo`) REFERENCES `photos` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-- 2014-02-19 09:41:00
