-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 02, 2019 at 08:12 AM
-- Server version: 5.7.21
-- PHP Version: 7.2.4
--
-- Database: `mojosmeh2019`
--
DROP DATABASE IF EXISTS `mojosmeh2019`;
CREATE DATABASE IF NOT EXISTS `mojosmeh2019` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `mojosmeh2019`;

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

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

DROP TABLE IF EXISTS `korisnik`;
CREATE TABLE IF NOT EXISTS `korisnik` (
  `ime` varchar(45) DEFAULT NULL,
  `prezime` varchar(45) DEFAULT NULL,
  `korisnicko_ime` varchar(45) NOT NULL,
  `lozinka` varchar(45) DEFAULT NULL,
  `tip` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`korisnicko_ime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

INSERT INTO `korisnik` (`ime`, `prezime`, `korisnicko_ime`, `lozinka`, `tip`) VALUES
('Admin', 'Admin', 'admin', 'admin123', 'administrator'),
('Laza', 'Lazic', 'laza', 'laza123', 'zubar'),
('Nikola', 'Rankovic', 'nikola', 'nikola123', 'pacijent'),
('Petar', 'Markovic', 'pera', 'pera123', 'pacijent'),
('Zika', 'Zikic', 'zika', 'zika123', 'zubar');

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

--
-- Table structure for table `pregledi`
--

DROP TABLE IF EXISTS `pregledi`;
CREATE TABLE IF NOT EXISTS `pregledi` (
  `idP` int(11) NOT NULL AUTO_INCREMENT,
  `pacijent` varchar(45) DEFAULT NULL,
  `datum` datetime DEFAULT NULL,
  `status` varchar(45) DEFAULT NULL,
  `zubar` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`idP`),
  KEY `fk_Pacijent` (`pacijent`),
  KEY `fk_Zubar` (`zubar`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `pregledi`
--

INSERT INTO `pregledi` (`idP`, `pacijent`, `datum`, `status`, `zubar`) VALUES
(1, 'pera', '2019-07-08 18:00:00', 'cekanje', 'laza'),
(2, 'pera', '2019-07-09 17:00:00', 'odobreno', 'zika'),
(3, 'nikola', '2019-07-08 20:00:00', 'odbijeno', 'laza');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `pregledi`
--
ALTER TABLE `pregledi`
  ADD CONSTRAINT `fk_Pacijent` FOREIGN KEY (`pacijent`) REFERENCES `korisnik` (`korisnicko_ime`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_Zubar` FOREIGN KEY (`zubar`) REFERENCES `korisnik` (`korisnicko_ime`) ON DELETE CASCADE ON UPDATE CASCADE;