-- phpMyAdmin SQL Dump
-- version 5.1.1deb5ubuntu1
-- https://www.phpmyadmin.net/
--
-- Počítač: localhost:3306
-- Vytvořeno: Úte 20. pro 2022, 23:38
-- Verze serveru: 10.6.11-MariaDB-0ubuntu0.22.04.1
-- Verze PHP: 8.1.2-1ubuntu2.9

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
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=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `Dance`:
--   `Group`
--       `DanceGroup` -> `Id`
--

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

--
-- Struktura tabulky `DanceFigure`
--

CREATE TABLE `DanceFigure` (
  `Id` int(11) NOT NULL,
  `NameCz` varchar(255) NOT NULL,
  `NameEn` varchar(255) NOT NULL,
  `Dance` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `DanceFigure`:
--   `Dance`
--       `Dance` -> `Id`
--

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

--
-- Struktura tabulky `DanceGroup`
--

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

--
-- VZTAHY TABULKY `DanceGroup`:
--

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

--
-- Struktura tabulky `Event`
--

CREATE TABLE `Event` (
  `Id` int(11) NOT NULL,
  `TimeFrom` datetime DEFAULT NULL,
  `TimeTo` datetime DEFAULT NULL,
  `Source` int(11) DEFAULT NULL,
  `Link` varchar(255) DEFAULT NULL,
  `Hidden` int(11) DEFAULT 0,
  `Description` text DEFAULT NULL,
  `Title` varchar(255) DEFAULT NULL,
  `Price` int(11) DEFAULT NULL,
  `Location` varchar(255) DEFAULT NULL,
  `TimeImport` datetime DEFAULT NULL,
  `RemoteId` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `Event`:
--

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

--
-- Struktura tabulky `EventSource`
--

CREATE TABLE `EventSource` (
  `Id` int(11) NOT NULL,
  `Name` varchar(255) DEFAULT NULL,
  `Method` varchar(255) DEFAULT NULL,
  `URL` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `EventSource`:
--

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

--
-- Struktura tabulky `MeetItem`
--

CREATE TABLE `MeetItem` (
  `Id` int(11) NOT NULL,
  `Message` mediumtext 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,
  `TimeImport` datetime DEFAULT NULL,
  `RemoteId` varchar(255) DEFAULT NULL,
  `Hidden` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `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,
  `Enabled` int(11) NOT NULL DEFAULT 1,
  `InsertURL` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `MeetSource`:
--

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

--
-- Struktura tabulky `Movie`
--

CREATE TABLE `Movie` (
  `Id` int(11) NOT NULL,
  `NameCz` varchar(255) NOT NULL,
  `NameEn` varchar(255) NOT NULL,
  `Year` int(11) NOT NULL,
  `Imdb` varchar(255) NOT NULL,
  `Csfd` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `Movie`:
--

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

--
-- 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=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `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=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `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=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `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=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- VZTAHY TABULKY `School`:
--

--
-- Indexy pro exportované tabulky
--

--
-- Indexy pro tabulku `Dance`
--
ALTER TABLE `Dance`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Group` (`Group`);

--
-- Indexy pro tabulku `DanceFigure`
--
ALTER TABLE `DanceFigure`
  ADD PRIMARY KEY (`Id`),
  ADD UNIQUE KEY `Id` (`Id`),
  ADD KEY `Dance` (`Dance`);

--
-- Indexy pro tabulku `DanceGroup`
--
ALTER TABLE `DanceGroup`
  ADD PRIMARY KEY (`Id`);

--
-- Indexy pro tabulku `Event`
--
ALTER TABLE `Event`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Source` (`Source`);

--
-- Indexy pro tabulku `EventSource`
--
ALTER TABLE `EventSource`
  ADD PRIMARY KEY (`Id`);

--
-- Indexy pro tabulku `MeetItem`
--
ALTER TABLE `MeetItem`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Source` (`Source`),
  ADD KEY `Time` (`Time`);

--
-- Indexy pro tabulku `MeetSource`
--
ALTER TABLE `MeetSource`
  ADD PRIMARY KEY (`Id`);

--
-- Indexy pro tabulku `Movie`
--
ALTER TABLE `Movie`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Year` (`Year`);

--
-- Indexy pro tabulku `Music`
--
ALTER TABLE `Music`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Dance` (`Dance`);

--
-- Indexy pro tabulku `Resource`
--
ALTER TABLE `Resource`
  ADD PRIMARY KEY (`Id`),
  ADD KEY `Dance` (`Dance`),
  ADD KEY `Group` (`Group`);

--
-- Indexy pro tabulku `ResourceGroup`
--
ALTER TABLE `ResourceGroup`
  ADD PRIMARY KEY (`Id`);

--
-- Indexy 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 `DanceFigure`
--
ALTER TABLE `DanceFigure`
  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 `Event`
--
ALTER TABLE `Event`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pro tabulku `EventSource`
--
ALTER TABLE `EventSource`
  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 pro tabulku `MeetSource`
--
ALTER TABLE `MeetSource`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pro tabulku `Movie`
--
ALTER TABLE `Movie`
  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;

--
-- 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 `DanceFigure`
--
ALTER TABLE `DanceFigure`
  ADD CONSTRAINT `DanceFigure_ibfk_1` FOREIGN KEY (`Dance`) REFERENCES `Dance` (`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`);
COMMIT;
