-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Počítač: 127.0.0.1
-- Vytvořeno: Sob 20. kvě 2017, 13:06
-- Verze serveru: 5.7.14
-- Verze PHP: 5.6.25

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 utf8mb4 */;

--
-- Databáze: `bakalarka`
--

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

--
-- Struktura tabulky `attendance`
--

CREATE TABLE `attendance` (
  `id` int(11) NOT NULL,
  `entryDate` datetime NOT NULL,
  `exitDate` datetime DEFAULT NULL,
  `state_type` tinyint(1) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `ownedBy` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Vypisuji data pro tabulku `attendance`
--

INSERT INTO `attendance` (`id`, `entryDate`, `exitDate`, `state_type`, `createdBy`, `ownedBy`) VALUES
(1, '2017-04-10 19:58:17', '2017-04-10 20:38:05', 1, 1, 1),
(4, '2017-04-16 21:00:26', '2017-04-16 21:58:34', 1, 1, 1),
(6, '2017-05-10 21:09:41', '2017-05-10 22:09:49', 1, 1, 1),
(7, '2017-04-20 22:00:53', '2017-04-20 22:56:00', 1, 1, 1),
(8, '2017-04-22 22:06:08', '2017-04-22 22:59:21', 1, 1, 1),
(11, '2017-05-12 22:03:35', '2017-05-12 22:56:42', 1, 1, 1),
(12, '2017-05-15 15:07:57', '2017-05-15 15:48:07', 1, 1, 1),
(13, '2017-05-17 17:06:14', '2017-05-17 18:08:20', 1, 1, 1),
(14, '2017-05-18 15:05:28', '2017-05-18 15:58:34', 1, 1, 1),
(15, '2017-05-11 15:16:23', NULL, 1, 1, 1),
(16, '2017-05-11 15:19:24', NULL, 1, 1, 2);

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

--
-- Struktura tabulky `card`
--

CREATE TABLE `card` (
  `id` int(11) NOT NULL,
  `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `state_type` int(11) NOT NULL,
  `creationDate` datetime NOT NULL,
  `assignedDate` datetime DEFAULT NULL,
  `modifiedDate` datetime DEFAULT NULL,
  `dateOfLoss` datetime DEFAULT NULL,
  `createdBy` int(11) NOT NULL,
  `assignedBy` int(11) DEFAULT NULL,
  `modifiedBy` int(11) DEFAULT NULL,
  `ownedBy` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Vypisuji data pro tabulku `card`
--

INSERT INTO `card` (`id`, `code`, `state_type`, `creationDate`, `assignedDate`, `modifiedDate`, `dateOfLoss`, `createdBy`, `assignedBy`, `modifiedBy`, `ownedBy`) VALUES
(1, '6XpVFELX1iuXuHxt', 1, '2017-05-10 19:59:31', NULL, NULL, NULL, 1, NULL, NULL, NULL),
(2, 'tmMoaNOdBmei05w4', 1, '2017-05-10 19:59:40', NULL, NULL, NULL, 1, NULL, NULL, NULL),
(3, 'i9XpuB1gXLl6BKa0', 2, '2017-05-10 19:59:48', '2017-05-11 15:17:09', NULL, NULL, 1, 1, NULL, 2),
(4, 'muZFKA3HFpnGT6dI', 2, '2017-05-10 19:59:55', '2017-05-10 20:22:34', NULL, NULL, 1, 1, NULL, 1),
(5, 'z9uKU8U1MX1YVzOW', 2, '2017-05-10 20:00:03', '2017-05-10 20:22:21', NULL, NULL, 1, 1, NULL, 3),
(6, 'WnV0yRkz9INpkrbF', 2, '2017-05-10 20:00:09', '2017-05-10 20:21:48', NULL, NULL, 1, 1, NULL, 4),
(7, 'qEM7R5uOoeAgrHkn', 2, '2017-05-10 20:00:16', '2017-05-10 20:21:36', NULL, NULL, 1, 1, NULL, 5),
(8, 'NRn7OPLXlvZKgoOK', 2, '2017-05-10 20:00:23', '2017-05-10 20:20:58', NULL, NULL, 1, 1, NULL, 6),
(9, 'zoxZbN9wVfZmsIA4', 3, '2017-05-10 20:00:31', '2017-05-10 20:20:46', '2017-05-10 20:22:53', NULL, 1, 1, 1, 7),
(10, 'GPIRCnlMFGsA1EL7', 3, '2017-05-10 20:00:39', '2017-05-10 20:20:18', '2017-05-10 20:21:21', NULL, 1, 1, 1, 8),
(11, 'CREZNiOit2NocqWl', 1, '2017-05-10 20:00:46', NULL, NULL, NULL, 1, NULL, NULL, NULL),
(12, 'sPE263p1baDxVnao', 1, '2017-05-10 20:00:54', NULL, NULL, NULL, 1, NULL, NULL, NULL);

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

--
-- Struktura tabulky `membership`
--

CREATE TABLE `membership` (
  `id` int(11) NOT NULL,
  `startDate` datetime NOT NULL,
  `endDate` datetime NOT NULL,
  `note` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `state_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `creationDate` datetime NOT NULL,
  `modifiedDate` datetime DEFAULT NULL,
  `createdBy` int(11) NOT NULL,
  `ownedBy` int(11) DEFAULT NULL,
  `modifiedBy` int(11) DEFAULT NULL,
  `membershipType` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Vypisuji data pro tabulku `membership`
--

INSERT INTO `membership` (`id`, `startDate`, `endDate`, `note`, `state_type`, `creationDate`, `modifiedDate`, `createdBy`, `ownedBy`, `modifiedBy`, `membershipType`) VALUES
(1, '2017-04-10 00:00:00', '2017-05-10 00:00:00', NULL, '1', '2017-04-10 19:22:39', NULL, 1, 1, NULL, 7),
(2, '2017-05-07 00:00:00', '2017-06-07 00:00:00', NULL, '1', '2017-05-10 20:24:44', NULL, 1, 2, NULL, 7),
(3, '2017-05-10 00:00:00', '2017-06-10 00:00:00', NULL, '1', '2017-05-11 15:04:16', NULL, 1, 1, NULL, 7),
(4, '2017-05-01 00:00:00', '2017-06-01 00:00:00', NULL, '1', '2017-05-11 15:18:24', NULL, 1, 2, NULL, 7),
(5, '2017-05-10 00:00:00', '2017-06-10 00:00:00', NULL, '1', '2017-05-11 15:19:17', NULL, 1, 3, NULL, 7);

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

--
-- Struktura tabulky `membership_type`
--

CREATE TABLE `membership_type` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `period_type` int(11) NOT NULL,
  `gender_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `state_type` tinyint(1) NOT NULL,
  `price` double NOT NULL,
  `creationDate` datetime NOT NULL,
  `modifiedDate` datetime DEFAULT NULL,
  `createdBy` int(11) NOT NULL,
  `modifiedBy` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Vypisuji data pro tabulku `membership_type`
--

INSERT INTO `membership_type` (`id`, `name`, `period_type`, `gender_type`, `state_type`, `price`, `creationDate`, `modifiedDate`, `createdBy`, `modifiedBy`) VALUES
(1, 'Happy Hours', 10, 'barbar', 1, 15, '2017-05-10 19:09:32', '2017-05-10 19:11:52', 1, 1),
(2, 'Happy Hours', 10, 'barbarka', 1, 15, '2017-05-10 19:09:49', '2017-05-10 19:11:56', 1, 1),
(3, 'Happy Hours', 10, 'junior', 1, 15, '2017-05-10 19:10:06', '2017-05-10 19:11:59', 1, 1),
(4, 'Víkendová', 1, 'barbar', 1, 18, '2017-05-10 19:11:17', '2017-05-10 19:12:02', 1, 1),
(5, 'Víkendová', 1, 'barbarka', 1, 16, '2017-05-10 19:11:28', '2017-05-10 19:12:06', 1, 1),
(6, 'Víkendová', 1, 'junior', 1, 16, '2017-05-10 19:11:45', '2017-05-10 19:12:09', 1, 1),
(7, 'Mesačná', 100, 'barbar', 1, 25, '2017-05-10 19:15:55', '2017-05-10 19:16:39', 1, 1),
(8, 'Mesačná', 100, 'barbarka', 1, 20, '2017-05-10 19:16:15', '2017-05-10 19:16:37', 1, 1),
(9, 'Mesačná', 100, 'junior', 1, 22, '2017-05-10 19:16:30', '2017-05-10 19:16:36', 1, 1),
(10, 'Polročná', 600, 'barbar', 1, 160, '2017-05-10 19:17:31', '2017-05-10 19:18:36', 1, 1),
(11, 'Polročná', 600, 'barbarka', 1, 110, '2017-05-10 19:18:15', '2017-05-10 19:18:35', 1, 1),
(12, 'Polročná', 600, 'junior', 1, 120, '2017-05-10 19:18:27', '2017-05-10 19:18:34', 1, 1),
(13, 'Ročná', 1200, 'barbar', 1, 275, '2017-05-10 19:20:35', '2017-05-10 19:21:17', 1, 1),
(14, 'Ročná', 1200, 'barbarka', 1, 220, '2017-05-10 19:20:54', '2017-05-10 19:21:17', 1, 1),
(15, 'Ročná', 1200, 'junior', 1, 240, '2017-05-10 19:21:09', '2017-05-11 15:33:33', 1, 1);

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

--
-- Struktura tabulky `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `surname` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'priezvisko',
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `ip` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `registrationDate` datetime NOT NULL,
  `dateOfBirth` datetime NOT NULL,
  `role` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Vypisuji data pro tabulku `user`
--

INSERT INTO `user` (`id`, `name`, `surname`, `email`, `password`, `ip`, `phone`, `registrationDate`, `dateOfBirth`, `role`) VALUES
(1, 'Test', 'Zamestnanec', 'zamestnanec@test.test', '$2y$10$Gco/uT71EBXq0/uAjMsE7uG2FG8JU0QBXe9PCtTvTwaD7ZVvq0JGq', '::1', '-', '2017-03-17 18:47:36', '1994-09-05 00:00:00', 3),
(2, 'Test', 'Člen', 'clen@test.test', '$2y$10$e6tvrdaTdTCd6DxSkB7n2O8ipwLkC1Ijcb.1H/WwFQ488sR/wa5JW', '::1', '-', '2017-05-10 18:54:35', '1989-06-14 00:00:00', 2),
(3, 'Test', 'Člen 2', 'clen2@test.test', '$2y$10$33Y7Xm81yvZD6pMgOhwB2OxmgC4BLCAw3Iv7dtWd//7htCB8SHdD6', '::1', '-', '2017-05-10 19:38:54', '1990-02-16 00:00:00', 2),
(4, 'Test', 'Člen 3', 'clen3@test.test', '$2y$10$S0U5JnThLnW0Mp9qUioH2.jTKobRmEFOvGR.Ahd3ydlDRK3XIzO5.', '::1', '-', '2017-05-10 19:39:39', '1987-05-17 00:00:00', 2),
(5, 'Test', 'Člen 4', 'clen4@test.test', '$2y$10$ySDpbGvKyXfZci1vW.gUUeZRHMUHtSGMFocUdYfjzeTQ5JkiVdV/u', '::1', '-', '2017-05-10 20:12:13', '1990-05-01 00:00:00', 2),
(6, 'Test', 'Člen 5', 'clen5@test.test', '$2y$10$O.l1pBjAWDzs2nKv14wZzO1Xc2y8zrXD/B8HzJworFBiBCu/a1K6e', '::1', '-', '2017-05-10 20:12:37', '1991-02-13 00:00:00', 4),
(7, 'Test', 'Člen 6', 'clen6@test.test', '$2y$10$hSA8OCJZv9t327mq4Xfqpe4jtkSyPwhG7M9aKshXTBfmzbSCdPDZG', '::1', '-', '2017-05-10 20:13:26', '1980-11-23 00:00:00', 1),
(8, 'Test', 'Člen 7', 'clen7@test.test', '$2y$10$KZGFSGXqqs9xmamrJkDmquKlnU61pkRHjaI782hWdBxOyAkRkR8ZW', '::1', '-', '2017-05-10 20:14:28', '1975-09-26 00:00:00', 1);

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

--
-- Klíče pro tabulku `attendance`
--
ALTER TABLE `attendance`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_6DE30D91D3564642` (`createdBy`),
  ADD KEY `IDX_6DE30D91780797F5` (`ownedBy`);

--
-- Klíče pro tabulku `card`
--
ALTER TABLE `card`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `UNIQ_161498D377153098` (`code`),
  ADD KEY `IDX_161498D3D3564642` (`createdBy`),
  ADD KEY `IDX_161498D3B3331171` (`assignedBy`),
  ADD KEY `IDX_161498D3ECF9771D` (`modifiedBy`),
  ADD KEY `IDX_161498D3780797F5` (`ownedBy`);

--
-- Klíče pro tabulku `membership`
--
ALTER TABLE `membership`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_86FFD285D3564642` (`createdBy`),
  ADD KEY `IDX_86FFD285780797F5` (`ownedBy`),
  ADD KEY `IDX_86FFD285ECF9771D` (`modifiedBy`),
  ADD KEY `IDX_86FFD285EF998427` (`membershipType`);

--
-- Klíče pro tabulku `membership_type`
--
ALTER TABLE `membership_type`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_F7E162E2D3564642` (`createdBy`),
  ADD KEY `IDX_F7E162E2ECF9771D` (`modifiedBy`);

--
-- Klíče pro tabulku `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `UNIQ_8D93D649E7927C74` (`email`);

--
-- AUTO_INCREMENT pro tabulky
--

--
-- AUTO_INCREMENT pro tabulku `attendance`
--
ALTER TABLE `attendance`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT pro tabulku `card`
--
ALTER TABLE `card`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT pro tabulku `membership`
--
ALTER TABLE `membership`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT pro tabulku `membership_type`
--
ALTER TABLE `membership_type`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT pro tabulku `user`
--
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Omezení pro exportované tabulky
--

--
-- Omezení pro tabulku `attendance`
--
ALTER TABLE `attendance`
  ADD CONSTRAINT `FK_6DE30D91780797F5` FOREIGN KEY (`ownedBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_6DE30D91D3564642` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`);

--
-- Omezení pro tabulku `card`
--
ALTER TABLE `card`
  ADD CONSTRAINT `FK_161498D3780797F5` FOREIGN KEY (`ownedBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_161498D3B3331171` FOREIGN KEY (`assignedBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_161498D3D3564642` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_161498D3ECF9771D` FOREIGN KEY (`modifiedBy`) REFERENCES `user` (`id`);

--
-- Omezení pro tabulku `membership`
--
ALTER TABLE `membership`
  ADD CONSTRAINT `FK_86FFD285780797F5` FOREIGN KEY (`ownedBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_86FFD285D3564642` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_86FFD285ECF9771D` FOREIGN KEY (`modifiedBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_86FFD285EF998427` FOREIGN KEY (`membershipType`) REFERENCES `membership_type` (`id`);

--
-- Omezení pro tabulku `membership_type`
--
ALTER TABLE `membership_type`
  ADD CONSTRAINT `FK_F7E162E2D3564642` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `FK_F7E162E2ECF9771D` FOREIGN KEY (`modifiedBy`) REFERENCES `user` (`id`);

/*!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 */;
