-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: May 10, 2024 at 07:34 PM
-- Server version: 8.0.21
-- PHP Version: 7.4.9

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
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 */;

--
-- Database: `picerija2024`
--
CREATE DATABASE IF NOT EXISTS `picerija2024` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `picerija2024`;

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

--
-- Table structure for table `dodaci`
--

DROP TABLE IF EXISTS `dodaci`;
CREATE TABLE IF NOT EXISTS `dodaci` (
  `naziv` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `cena` int NOT NULL,
  `dostupan` tinyint(1) NOT NULL,
  PRIMARY KEY (`naziv`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `dodaci`
--

INSERT INTO `dodaci` (`naziv`, `cena`, `dostupan`) VALUES
('ananas', 100, 0),
('crne masline', 50, 0),
('kulen', 50, 1),
('pelat', 30, 1),
('prsuta', 100, 1),
('sampinjoni', 50, 0),
('sir', 50, 1),
('sunka', 50, 1),
('zelene masline', 50, 1);

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

--
-- Table structure for table `korisnici`
--

DROP TABLE IF EXISTS `korisnici`;
CREATE TABLE IF NOT EXISTS `korisnici` (
  `korisnicko_ime` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `lozinka` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `ime` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `prezime` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `tip` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  PRIMARY KEY (`korisnicko_ime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `korisnici`
--

INSERT INTO `korisnici` (`korisnicko_ime`, `lozinka`, `ime`, `prezime`, `tip`) VALUES
('ana', 'ana123', 'Ana', 'Andjelkovic', 'kupac'),
('maja', 'maja123', 'Marija', 'Maric', 'administrator'),
('paja', 'paja123', 'Pavle', 'Pajic', 'kupac'),
('pera', 'pera123', 'Petar', 'Peric', 'administrator');

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

--
-- Table structure for table `narudzbine`
--

DROP TABLE IF EXISTS `narudzbine`;
CREATE TABLE IF NOT EXISTS `narudzbine` (
  `id` int NOT NULL AUTO_INCREMENT,
  `kupac` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `pica` varchar(50) NOT NULL,
  `velicina` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `dodaci` varchar(200) NOT NULL,
  `cena` int NOT NULL,
  `status` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user` (`kupac`),
  KEY `fk` (`pica`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `narudzbine`
--

INSERT INTO `narudzbine` (`id`, `kupac`, `pica`, `velicina`, `dodaci`, `cena`, `status`) VALUES
(1, 'ana', 'kapricoza', 'mala', 'kulen', 600, 'nova'),
(2, 'paja', 'kapricoza', 'srednja', '', 650, 'prihvacena'),
(3, 'paja', 'vezuvio', 'velika', 'kulen,crne masline', 800, 'nova'),
(4, 'ana', '4 sira', 'srednja', 'kulen,ananas', 850, 'odbijena');

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

--
-- Table structure for table `pice`
--

DROP TABLE IF EXISTS `pice`;
CREATE TABLE IF NOT EXISTS `pice` (
  `naziv` varchar(50) NOT NULL,
  `cena` int NOT NULL,
  `opis` varchar(100) NOT NULL,
  PRIMARY KEY (`naziv`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `pice`
--

INSERT INTO `pice` (`naziv`, `cena`, `opis`) VALUES
('4 sira', 600, 'gorgonzola, pekorino, mocarela, gauda'),
('kapricoza', 550, 'pelat, sir, sunka, sampinjoni'),
('margarita', 450, 'pelat, sir, bosiljak'),
('vezuvio', 500, 'pelat, sir, sunka');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `narudzbine`
--
ALTER TABLE `narudzbine`
  ADD CONSTRAINT `fk_pica` FOREIGN KEY (`pica`) REFERENCES `pice` (`naziv`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  ADD CONSTRAINT `fk_user` FOREIGN KEY (`kupac`) REFERENCES `korisnici` (`korisnicko_ime`);
COMMIT;

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