-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 09. Dez 2017 um 16:39
-- Server-Version: 10.1.16-MariaDB
-- PHP-Version: 7.0.9

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

--
-- Datenbank: `ppb`
--

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

--
-- Tabellenstruktur für Tabelle `user`
--

CREATE TABLE `user` (
  `id` varchar(36) NOT NULL,
  `username` varchar(8) NOT NULL,
  `firstname` varchar(40) NOT NULL,
  `lastname` varchar(40) NOT NULL,
  `email` varchar(300) NOT NULL,
  `pw` varchar(255) NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `gallery` (
  `id` varchar(36) NOT NULL,
  `userId` varchar(36) NOT NULL,
  `categoryId` varchar(36) NOT NULL,
  `title` varchar(80) NOT NULL,
  `filename` varchar(200) NOT NULL,
  `description` varchar(300) NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `category` (
  `id` varchar(36) NOT NULL,
  `description` varchar(200) NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


--
-- Indizes für die Tabelle `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

ALTER TABLE `category`
  ADD PRIMARY KEY (`id`); 

ALTER TABLE `gallery`
  ADD PRIMARY KEY (`id`),
  ADD CONSTRAINT `FK_EventUser` FOREIGN KEY (`userId`) REFERENCES `user`(`id`),
  ADD CONSTRAINT `FK_EventCategory` FOREIGN KEY (`categoryId`) REFERENCES `category`(`id`);

--
-- Daten für Tabelle `user`
--
-- pw: 12345 -> $2y$10$IeMpvUuMIrnxFHN.j94tEe.T1rjsTga1yYoyt5JAAXYUwbbjh1km6

INSERT INTO `user` (`id`, `username`, `firstname`, `lastname`, `email`, `pw`, `created`) VALUES
('0bb28278-d28a-11e7-b93f-2c4d544f8fe0', 'stefan78', 'Stefan', 'Stativ', 
'test@test.de', '$2y$10$IeMpvUuMIrnxFHN.j94tEe.T1rjsTga1yYoyt5JAAXYUwbbjh1km6', '2017-11-26 09:13:20'),
('4f141df7-3c0a-11e8-b046-2c4d544f8fe0', 'fiona84', 'Fiona', 'Filter', 
'fiona@test.de', '$2y$10$IeMpvUuMIrnxFHN.j94tEe.T1rjsTga1yYoyt5JAAXYUwbbjh1km6', '2018-01-12 11:11:51');

INSERT INTO `category` (`id`, `description`, `created`) VALUES
('23911087-3420-11e8-be39-2c4d544f8fe0', 'Portrait', '2018-04-14 12:11:31'),
('4a952637-3422-11e8-be39-2c4d544f8fe0', 'Natur', '2018-04-14 12:11:31'),
('999e18d3-3420-11e8-be39-2c4d544f8fe0', 'Landschaft', '2018-04-14 12:11:31'),
('dc3a66d9-3c0a-11e8-b046-2c4d544f8fe0', 'Urban', '2018-04-14 12:11:31');

INSERT INTO `gallery`(`id`, `userId`, `categoryId`, `title`, `filename`, `description`, `created`) VALUES 
('b164bc94-eaf1-11e7-a313-2c4d544f8fe0', '0bb28278-d28a-11e7-b93f-2c4d544f8fe0', '23911087-3420-11e8-be39-2c4d544f8fe0',
 'Ich selbst', 'stefan78-001.jpeg', 'Foto eines jungen Mannes mit Kamera', '2018-04-14 12:11:31'),
('7519223c-3429-11e8-be39-2c4d544f8fe0', '0bb28278-d28a-11e7-b93f-2c4d544f8fe0', '23911087-3420-11e8-be39-2c4d544f8fe0'
, 'Licht', 'stefan78-003.jpeg', 'Foto einer jungen Frau bei Nacht', '2018-03-12 09:31:12'), 
('d746f216-eaf1-11e7-a313-2c4d544f8fe0', '0bb28278-d28a-11e7-b93f-2c4d544f8fe0', '4a952637-3422-11e8-be39-2c4d544f8fe0'
, 'Flowers', 'stefan78-002.jpeg', 'Weiße und rote Blumen', '2018-03-12 09:33:32'),
('0ccef76b-3da0-11e8-9afe-2c4d544f8fe0', '4f141df7-3c0a-11e8-b046-2c4d544f8fe0', 'dc3a66d9-3c0a-11e8-b046-2c4d544f8fe0',
 'Endlos', 'fiona84-001.jpeg', 'Eine spiralförmige Treppe', '2018-05-12 12:11:31'),
('61f52468-3da0-11e8-9afe-2c4d544f8fe0', '4f141df7-3c0a-11e8-b046-2c4d544f8fe0', '999e18d3-3420-11e8-be39-2c4d544f8fe0'
, 'Morgenrot', 'fiona84-002.jpeg', 'Sonnenaufgang am Strand', '2018-01-11 09:31:12'), 
('68f78c36-3da0-11e8-9afe-2c4d544f8fe0', '4f141df7-3c0a-11e8-b046-2c4d544f8fe0', 'dc3a66d9-3c0a-11e8-b046-2c4d544f8fe0'
, 'Tiefe Wolken', 'fiona84-003.jpeg', 'Eine Brücke im Nebel', '2018-02-23 09:33:32');


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

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