-- 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 `projects`;
CREATE TABLE `projects` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` int(11) NOT NULL,
  `added` datetime NOT NULL,
  `updated` datetime NOT NULL,
  `year_launch` year(4) NOT NULL,
  `year_completition` int(11) NOT NULL,
  `authors` text NOT NULL,
  `collaborators` text,
  `location_gm_lng` varchar(15) DEFAULT NULL,
  `location_gm_lat` varchar(15) DEFAULT NULL,
  `location_gm_zoom` tinyint(4) DEFAULT NULL,
  `streetview_lat` varchar(40) DEFAULT NULL,
  `streetview_lng` varchar(40) DEFAULT NULL,
  `streetview_heading` varchar(40) DEFAULT NULL,
  `streetview_pitch` varchar(40) DEFAULT NULL,
  `streetview_zoom` varchar(40) DEFAULT NULL,
  `streetview_show` tinyint(1) DEFAULT NULL,
  `buildup_area` int(11) DEFAULT NULL,
  `costs` int(11) DEFAULT NULL,
  `under_construction` tinyint(1) DEFAULT NULL,
  `videos` text,
  `show` tinyint(1) NOT NULL,
  `show_on_main_page` tinyint(1) NOT NULL,
  `show_on_teasers` tinyint(1) DEFAULT NULL,
  `web` varchar(255) NOT NULL,
  `mainphoto` int(11) DEFAULT NULL,
  `text_only` tinyint(1) DEFAULT NULL,
  `order` int(11) DEFAULT NULL,
  `order_in_category` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `category` (`category`),
  KEY `mainphoto` (`mainphoto`),
  CONSTRAINT `projects_ibfk_1` FOREIGN KEY (`category`) REFERENCES `projects_categories` (`id`),
  CONSTRAINT `projects_ibfk_4` FOREIGN KEY (`mainphoto`) REFERENCES `photos` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `projects_categories`;
CREATE TABLE `projects_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order` mediumint(9) NOT NULL,
  `show` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `projects_categories_contents`;
CREATE TABLE `projects_categories_contents` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` int(11) NOT NULL,
  `language` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `language_category` (`language`,`category`),
  UNIQUE KEY `language_category_name` (`language`,`category`,`name`),
  UNIQUE KEY `language_category_url` (`language`,`category`,`url`),
  KEY `category` (`category`),
  CONSTRAINT `projects_categories_contents_ibfk_2` FOREIGN KEY (`category`) REFERENCES `projects_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `projects_categories_contents_ibfk_3` FOREIGN KEY (`language`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `projects_contents`;
CREATE TABLE `projects_contents` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project` int(11) NOT NULL,
  `language` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `client` varchar(255) DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `published` text,
  `exhibitions` text,
  `awards` text,
  `note` varchar(255) DEFAULT NULL,
  `url` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `language_project` (`language`,`project`),
  KEY `project` (`project`),
  CONSTRAINT `projects_contents_ibfk_1` FOREIGN KEY (`project`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `projects_contents_ibfk_2` FOREIGN KEY (`language`) REFERENCES `languages` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `projects_photos`;
CREATE TABLE `projects_photos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project` int(11) NOT NULL,
  `photo` int(11) NOT NULL,
  `order` mediumint(9) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `project_photo` (`project`,`photo`),
  KEY `photo` (`photo`),
  CONSTRAINT `projects_photos_ibfk_1` FOREIGN KEY (`project`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  CONSTRAINT `projects_photos_ibfk_2` FOREIGN KEY (`photo`) REFERENCES `photos` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


-- 2014-03-26 18:46:51