-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 23. Mai 2013 um 11:30
-- Server Version: 5.5.27
-- PHP-Version: 5.4.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Datenbank: `geodb`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `domain`
--

CREATE TABLE IF NOT EXISTS `domain` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `information`
--

CREATE TABLE IF NOT EXISTS `information` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `place`
--

CREATE TABLE IF NOT EXISTS `place` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `plan` geometry NOT NULL,
  `parent` int(32) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- RELATIONEN DER TABELLE `place`:
--   `parent`
--       `place` -> `id`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `placealias`
--

CREATE TABLE IF NOT EXISTS `placealias` (
  `aid` int(32) NOT NULL AUTO_INCREMENT,
  `pid` int(32) NOT NULL,
  `alias` varchar(250) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`aid`,`pid`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;

--
-- RELATIONEN DER TABELLE `placealias`:
--   `pid`
--       `place` -> `id`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `placedomain`
--

CREATE TABLE IF NOT EXISTS `placedomain` (
  `pid` int(32) NOT NULL,
  `did` int(32) NOT NULL,
  PRIMARY KEY (`pid`,`did`),
  KEY `did` (`did`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- RELATIONEN DER TABELLE `placedomain`:
--   `did`
--       `domain` -> `id`
--   `pid`
--       `place` -> `id`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `placeinformation`
--

CREATE TABLE IF NOT EXISTS `placeinformation` (
  `pid` int(32) NOT NULL,
  `iid` int(32) NOT NULL,
  `value` varchar(500) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`pid`,`iid`),
  KEY `iid` (`iid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- RELATIONEN DER TABELLE `placeinformation`:
--   `iid`
--       `information` -> `id`
--   `pid`
--       `place` -> `id`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `placeservice`
--

CREATE TABLE IF NOT EXISTS `placeservice` (
  `pid` int(32) NOT NULL,
  `sid` int(32) NOT NULL,
  `request` varchar(250) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`pid`,`sid`),
  KEY `sid` (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- RELATIONEN DER TABELLE `placeservice`:
--   `sid`
--       `service` -> `id`
--   `pid`
--       `place` -> `id`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `service`
--

CREATE TABLE IF NOT EXISTS `service` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `sap` varchar(250) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Constraints der exportierten Tabellen
--

--
-- Constraints der Tabelle `placealias`
--
ALTER TABLE `placealias`
  ADD CONSTRAINT `placealias_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `placedomain`
--
ALTER TABLE `placedomain`
  ADD CONSTRAINT `placedomain_ibfk_2` FOREIGN KEY (`did`) REFERENCES `domain` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `placedomain_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `placeinformation`
--
ALTER TABLE `placeinformation`
  ADD CONSTRAINT `placeinformation_ibfk_2` FOREIGN KEY (`iid`) REFERENCES `information` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `placeinformation_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `placeservice`
--
ALTER TABLE `placeservice`
  ADD CONSTRAINT `placeservice_ibfk_2` FOREIGN KEY (`sid`) REFERENCES `service` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `placeservice_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
