-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 04, 2017 at 02:43 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12

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

--
-- Database: `lastminute2017`
--
CREATE DATABASE IF NOT EXISTS `lastminute2017` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `lastminute2017`;

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

--
-- Table structure for table `aranzman`
--

DROP TABLE IF EXISTS `aranzman`;
CREATE TABLE IF NOT EXISTS `aranzman` (
  `id` int(15) NOT NULL AUTO_INCREMENT,
  `destinacija` varchar(50) NOT NULL,
  `hotel` varchar(150) NOT NULL,
  `kategorija` int(10) NOT NULL,
  `prevoz` varchar(50) NOT NULL,
  `datum_pol` date NOT NULL,
  `datum_dol` date NOT NULL,
  `br_nocenja` int(10) NOT NULL,
  `cena` int(15) NOT NULL,
  `last_minute` int(11) NOT NULL COMMENT '0 - nije last minute, >0 - procenat umanjenja',
  PRIMARY KEY (`id`),
  KEY `kategorija` (`kategorija`),
  KEY `kategorija_2` (`kategorija`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;

--
-- Dumping data for table `aranzman`
--

INSERT INTO `aranzman` (`id`, `destinacija`, `hotel`, `kategorija`, `prevoz`, `datum_pol`, `datum_dol`, `br_nocenja`, `cena`, `last_minute`) VALUES
(1, 'Rodos', 'Noufara 2*', 1, 'avion', '2017-07-07', '2017-07-17', 10, 375, 0),
(2, 'Rodos', 'Noufara 2*', 1, 'avion', '2017-07-17', '2017-07-27', 10, 385, 0),
(3, 'Rodos', 'Noufara 2*', 2, 'avion', '2017-07-07', '2017-07-17', 10, 485, 0),
(4, 'Rodos', 'Noufara 2*', 2, 'avion', '2017-07-17', '2017-07-27', 10, 500, 0),
(5, 'Hurgada', 'Mina Mark Beach Resort', 4, 'avion', '2017-07-10', '2017-07-19', 9, 359, 0),
(6, 'Hurgada', 'Mina Mark Beach Resort', 4, 'avion', '2017-07-20', '2017-07-30', 10, 375, 0),
(7, 'Hurgada', 'Mina Mark Beach Resort', 4, 'avion', '2017-07-07', '2017-07-17', 10, 370, 30),
(8, 'Rodos', 'Royal Aparthotel 3*', 5, 'avion', '2017-07-07', '2017-07-17', 10, 435, 15),
(9, 'Rodos', 'Butterfly Boutique 3*', 5, 'avion', '2017-07-07', '2017-07-17', 10, 465, 0),
(10, 'Kalithea', 'Macedonian Sun 3*', 2, 'autobus', '2017-07-05', '2017-07-15', 10, 400, 30),
(11, 'Kalithea', 'Ammon Zeus 4*', 2, 'autobus', '2017-07-07', '2017-07-18', 11, 700, 25),
(12, 'Hanioti', 'Hotel Naias 3*', 3, 'sopstveni', '2017-07-07', '2017-07-18', 11, 506, 50);

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

--
-- Table structure for table `kategorija`
--

DROP TABLE IF EXISTS `kategorija`;
CREATE TABLE IF NOT EXISTS `kategorija` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `naziv` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `naziv` (`naziv`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `kategorija`
--

INSERT INTO `kategorija` (`id`, `naziv`) VALUES
(4, 'all-inclusive'),
(5, 'apartman'),
(1, 'nocenje sa doruckom'),
(3, 'pansion'),
(2, 'polu-pansion');

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

--
-- Table structure for table `korisnik`
--

DROP TABLE IF EXISTS `korisnik`;
CREATE TABLE IF NOT EXISTS `korisnik` (
  `korIme` varchar(50) NOT NULL,
  `lozinka` varchar(50) NOT NULL,
  `ime` varchar(50) NOT NULL,
  `prezime` varchar(50) NOT NULL,
  `tip` tinyint(1) unsigned NOT NULL COMMENT '0 - putnik, 1 - admin',
  PRIMARY KEY (`korIme`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `korisnik`
--

INSERT INTO `korisnik` (`korIme`, `lozinka`, `ime`, `prezime`, `tip`) VALUES
('aca', 'sifra123', 'Aleksandar', 'Lazic', 0),
('admin', 'admin123', 'Admin', 'Adminovic', 1),
('bosko', 'sifra123', 'Bosko', 'Nikolic', 0),
('drazen', 'sifra123', 'Drazen', 'Draskovic', 0),
('maja', 'sifra123', 'Maja', 'Vukasovic', 0),
('misa', 'sifra123', 'Dragisa', 'Miladinovic', 0),
('sanja', 'sifra123', 'Sanja', 'Delcev', 0);

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

--
-- Table structure for table `poruke`
--

DROP TABLE IF EXISTS `poruke`;
CREATE TABLE IF NOT EXISTS `poruke` (
  `id` int(15) NOT NULL AUTO_INCREMENT,
  `zainteresovanost` int(10) NOT NULL,
  `tekst` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `zainteresovanost` (`zainteresovanost`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `poruke`
--

INSERT INTO `poruke` (`id`, `zainteresovanost`, `tekst`) VALUES
(1, 4, 'Aranžman za destinaciju Rodos ima LAST MINUTE popust od 15%.'),
(2, 5, 'Aranžman za destinaciju Rodos ima LAST MINUTE popust od 15%.'),
(3, 13, 'Aranžman za destinaciju Hurgada ima LAST MINUTE popust od 30%.'),
(4, 14, 'Aranžman za destinaciju Hurgada ima LAST MINUTE popust od 30%.'),
(5, 10, 'Aranžman za destinaciju Hanioti ima LAST MINUTE popust od 50%.');

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

--
-- Table structure for table `zainteresovanost`
--

DROP TABLE IF EXISTS `zainteresovanost`;
CREATE TABLE IF NOT EXISTS `zainteresovanost` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `aranzman` int(15) NOT NULL,
  `korisnik` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `aranzman` (`aranzman`,`korisnik`),
  KEY `korisnik` (`korisnik`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;

--
-- Dumping data for table `zainteresovanost`
--

INSERT INTO `zainteresovanost` (`id`, `aranzman`, `korisnik`) VALUES
(11, 3, 'maja'),
(9, 4, 'aca'),
(8, 4, 'misa'),
(12, 5, 'bosko'),
(3, 6, 'drazen'),
(2, 6, 'maja'),
(1, 6, 'sanja'),
(13, 7, 'maja'),
(14, 7, 'sanja'),
(5, 8, 'maja'),
(4, 8, 'sanja'),
(7, 11, 'bosko'),
(6, 11, 'drazen'),
(10, 12, 'misa');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `aranzman`
--
ALTER TABLE `aranzman`
  ADD CONSTRAINT `fk_kategorija` FOREIGN KEY (`kategorija`) REFERENCES `kategorija` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `poruke`
--
ALTER TABLE `poruke`
  ADD CONSTRAINT `fk_z_p` FOREIGN KEY (`zainteresovanost`) REFERENCES `zainteresovanost` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `zainteresovanost`
--
ALTER TABLE `zainteresovanost`
  ADD CONSTRAINT `fk_oznaka_kor` FOREIGN KEY (`korisnik`) REFERENCES `korisnik` (`korIme`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_oznaka_ar` FOREIGN KEY (`aranzman`) REFERENCES `aranzman` (`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 */;
