-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Počítač: localhost:3306
-- Vytvořeno: Ned 30. pro 2018, 19:07
-- Verze serveru: 10.1.34-MariaDB-0ubuntu0.18.04.1
-- Verze PHP: 7.2.10-0ubuntu0.18.04.1

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

--
-- Databáze: `tanec`
--

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

--
-- Struktura tabulky `Dance`
--

CREATE TABLE `Dance` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Group` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `Dance`:
--   `Group`
--       `DanceGroup` -> `Id`
--

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

--
-- Struktura tabulky `DanceGroup`
--

CREATE TABLE `DanceGroup` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `DanceGroup`:
--

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

--
-- Struktura tabulky `MeetItem`
--

CREATE TABLE `MeetItem` (
  `Id` int(11) NOT NULL,
  `Message` text NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Age` int(11) DEFAULT NULL,
  `Height` int(11) DEFAULT NULL,
  `Source` int(11) NOT NULL,
  `Email` varchar(255) NOT NULL,
  `Phone` varchar(255) NOT NULL,
  `Gender` int(11) NOT NULL,
  `Time` datetime NOT NULL,
  `Weight` int(11) DEFAULT NULL,
  `Location` varchar(255) NOT NULL,
  `Link` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `MeetItem`:
--   `Source`
--       `MeetSource` -> `Id`
--

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

--
-- Struktura tabulky `MeetSource`
--

CREATE TABLE `MeetSource` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  `Method` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `MeetSource`:
--

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

--
-- Struktura tabulky `Music`
--

CREATE TABLE `Music` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  `Dance` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `Music`:
--   `Dance`
--       `Dance` -> `Id`
--

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

--
-- Struktura tabulky `Resource`
--

CREATE TABLE `Resource` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Dance` int(11) NOT NULL,
  `URL` varchar(255) NOT NULL,
  `Group` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `Resource`:
--   `Dance`
--       `Dance` -> `Id`
--   `Group`
--       `ResourceGroup` -> `Id`
--

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

--
-- Struktura tabulky `ResourceGroup`
--

CREATE TABLE `ResourceGroup` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `ResourceGroup`:
--

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

--
-- Struktura tabulky `School`
--

CREATE TABLE `School` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Address` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- RELACE PRO TABULKU `School`:
--

--
-- Klíče pro exportované tabulky
--

--
-- Klíče pro tabulku `Dance`
--
ALTER TABLE `Dance`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Group` (`Group`);

--
-- Klíče pro tabulku `DanceGroup`
--
ALTER TABLE `DanceGroup`
  ADD PRIMARY KEY (`Id`);

--
-- Klíče pro tabulku `MeetItem`
--
ALTER TABLE `MeetItem`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Source` (`Source`);

--
-- Klíče pro tabulku `MeetSource`
--
ALTER TABLE `MeetSource`
  ADD PRIMARY KEY (`Id`);

--
-- Klíče pro tabulku `Music`
--
ALTER TABLE `Music`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Dance` (`Dance`);

--
-- Klíče pro tabulku `Resource`
--
ALTER TABLE `Resource`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Dance` (`Dance`),
  ADD KEY `Group` (`Group`);

--
-- Klíče pro tabulku `ResourceGroup`
--
ALTER TABLE `ResourceGroup`
  ADD PRIMARY KEY (`Id`);

--
-- Klíče pro tabulku `School`
--
ALTER TABLE `School`
  ADD PRIMARY KEY (`Id`);

--
-- AUTO_INCREMENT pro tabulky
--

--
-- AUTO_INCREMENT pro tabulku `Dance`
--
ALTER TABLE `Dance`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pro tabulku `DanceGroup`
--
ALTER TABLE `DanceGroup`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pro tabulku `MeetItem`
--
ALTER TABLE `MeetItem`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=93;
--
-- AUTO_INCREMENT pro tabulku `MeetSource`
--
ALTER TABLE `MeetSource`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT pro tabulku `Music`
--
ALTER TABLE `Music`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pro tabulku `Resource`
--
ALTER TABLE `Resource`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pro tabulku `ResourceGroup`
--
ALTER TABLE `ResourceGroup`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pro tabulku `School`
--
ALTER TABLE `School`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Omezení pro exportované tabulky
--

--
-- Omezení pro tabulku `Dance`
--
ALTER TABLE `Dance`
  ADD CONSTRAINT `Dance_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `DanceGroup` (`Id`);

--
-- Omezení pro tabulku `MeetItem`
--
ALTER TABLE `MeetItem`
  ADD CONSTRAINT `MeetItem_ibfk_1` FOREIGN KEY (`Source`) REFERENCES `MeetSource` (`Id`);

--
-- Omezení pro tabulku `Music`
--
ALTER TABLE `Music`
  ADD CONSTRAINT `Music_ibfk_1` FOREIGN KEY (`Dance`) REFERENCES `Dance` (`Id`);

--
-- Omezení pro tabulku `Resource`
--
ALTER TABLE `Resource`
  ADD CONSTRAINT `Resource_ibfk_1` FOREIGN KEY (`Dance`) REFERENCES `Dance` (`Id`),
  ADD CONSTRAINT `Resource_ibfk_2` FOREIGN KEY (`Group`) REFERENCES `ResourceGroup` (`Id`);
