CREATE DATABASE  IF NOT EXISTS `restkiosk` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `restkiosk`;


DROP TABLE IF EXISTS `comandes`;

CREATE TABLE `comandes` (
  `IdComanda` int(11) NOT NULL AUTO_INCREMENT,
  `DataHora` datetime DEFAULT NULL,
  PRIMARY KEY (`IdComanda`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `families`;

CREATE TABLE `families` (
  `IdFamilia` int(11) NOT NULL AUTO_INCREMENT,
  `Descripcio` varchar(45) DEFAULT NULL,
  `Visible` bit(1) DEFAULT b'0',
  `Ordre` int(11) DEFAULT NULL,
  PRIMARY KEY (`IdFamilia`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `menus`;

CREATE TABLE `menus` (
  `IdMenu` int(11) NOT NULL AUTO_INCREMENT,
  `Descripcio` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `Ordre` int(11) DEFAULT NULL,
  `Preu` float DEFAULT NULL,
  `Titol` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `Visible` tinyint(1) DEFAULT NULL,
  `Imatge` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`IdMenu`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `productes`;

CREATE TABLE `productes` (
  `IdProducte` int(11) NOT NULL AUTO_INCREMENT,
  `Descripcio` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `Ordre` int(11) DEFAULT NULL,
  `Preu` float DEFAULT NULL,
  `Titol` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
  `Visible` tinyint(1) DEFAULT NULL,
  `Imatge` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`IdProducte`)
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `familiesrelmenus`;

CREATE TABLE `familiesrelmenus` (
  `IdFamilia` int(11) NOT NULL,
  `IdMenu` int(11) NOT NULL,
  PRIMARY KEY (`IdFamilia`,`IdMenu`),
  UNIQUE KEY `IdMenu` (`IdMenu`),
  KEY `FKE756CF1DAF490F21` (`IdFamilia`),
  KEY `FKE756CF1D87B59017` (`IdMenu`),
  CONSTRAINT `FKE756CF1D87B59017` FOREIGN KEY (`IdMenu`) REFERENCES `menus` (`IdMenu`),
  CONSTRAINT `FKE756CF1DAF490F21` FOREIGN KEY (`IdFamilia`) REFERENCES `families` (`IdFamilia`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `familiesrelproductes`;

CREATE TABLE `familiesrelproductes` (
  `IdFamilia` int(11) NOT NULL,
  `IdProducte` int(11) NOT NULL,
  PRIMARY KEY (`IdFamilia`,`IdProducte`),
  UNIQUE KEY `IdProducte` (`IdProducte`),
  KEY `FKCE5B5586AF490F21` (`IdFamilia`),
  KEY `FKCE5B55866452B385` (`IdProducte`),
  CONSTRAINT `FKCE5B55866452B385` FOREIGN KEY (`IdProducte`) REFERENCES `productes` (`IdProducte`),
  CONSTRAINT `FKCE5B5586AF490F21` FOREIGN KEY (`IdFamilia`) REFERENCES `families` (`IdFamilia`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `menusrelproductes`;

CREATE TABLE `menusrelproductes` (
  `IdMenu` int(11) NOT NULL,
  `IdProducte` int(11) NOT NULL,
  `Tipus` varchar(1) DEFAULT NULL,
  PRIMARY KEY (`IdMenu`,`IdProducte`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `usuaris`;

CREATE TABLE `usuaris` (
  `login` varchar(45) NOT NULL,
  `password` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


LOCK TABLES `usuaris` WRITE;
/*!40000 ALTER TABLE `usuaris` DISABLE KEYS */;
INSERT INTO `usuaris` VALUES ('admin','03dc55930c1bee3a8f460449a5d3e2c4');
/*!40000 ALTER TABLE `usuaris` ENABLE KEYS */;
UNLOCK TABLES;

LOCK TABLES `families` WRITE;
/*!40000 ALTER TABLE `families` DISABLE KEYS */;
INSERT INTO `families` VALUES (10,'Entrepans','',3),(11,'Begudes','',2),(16,'Pizzes','',5),(17,'Pica pica','',0),(18,'Amanides','',1),(19,'Pastes','',4),(20,'Postres','',6);
/*!40000 ALTER TABLE `families` ENABLE KEYS */;
UNLOCK TABLES;

LOCK TABLES `menus` WRITE;
/*!40000 ALTER TABLE `menus` DISABLE KEYS */;
INSERT INTO `menus` VALUES (1,'Tria la pizza que més t\'agradi, alguna coseta per picar i una beguda refrescant. Tot al millor preu.',0,9,'Entrant + Pizza + Beguda',1,'menu_1.jpg'),(2,'Tria l\'entrepà que més t\'agradi, alguna coseta per picar i una beguda refrescant. Tot al millor preu.',1,8,'Entrant + Entrepà + Beguda',1,''),(5,'Tria algo per picar, una amanida i una beguda. Tot al millor preu.',2,8.5,'Entrant + Amanida + Beguda',1,''),(6,'Tria la pasta que més t\'agradi, alguna coseta per picar i una beguda refrescant. Tot al millor preu.',3,8.5,'Entrant + Pasta + Beguda',1,'');
/*!40000 ALTER TABLE `menus` ENABLE KEYS */;
UNLOCK TABLES;

LOCK TABLES `productes` WRITE;
/*!40000 ALTER TABLE `productes` DISABLE KEYS */;
INSERT INTO `productes` VALUES (1,'Pernil',7,4,'Pernil',1,'prod_1.png'),(2,'Pernil i formatge',27,4.5,'Pernil i formatge',1,'prod_2.png'),(3,'Bacon',35,4,'Bacon',1,'prod_3.png'),(4,'Bacon i formatge',37,0,'Bacon i formatge',1,'prod_4.png'),(5,'Tonyina',38,4,'Tonyina',1,NULL),(6,'Vegetal ',39,4,'Vegetal ',1,NULL),(7,'Llom',40,4,'Llom',1,'prod_7.png'),(8,'Llom i formatge',41,0,'Llom i formatge',1,'prod_8.png'),(9,'Margarita',42,8.5,'Margarita',1,NULL),(10,'Carbonara',0,8.5,'Carbonara',0,'prod_10.jpg'),(11,'Hawaiana',6,8.5,'Hawaiana',1,''),(12,'Capresse',30,8.5,'Capresse',1,NULL),(13,'4 Estacions',0,8.5,'4 Estacions',1,'prod_13.png'),(14,'4 Formatges',25,8.5,'4 Formatges',1,'prod_14.png'),(15,'Mediterranea',26,8.5,'Mediterranea',1,NULL),(16,'Barbacoa',28,8.5,'Barbacoa',1,'prod_16.png'),(17,'Serrana',29,8.5,'Serrana',1,NULL),(18,'Pollastre',31,8.5,'Pollastre',1,NULL),(19,'Formatge de cabra',32,10,'Formatge de cabra',1,'prod_19.png'),(20,'Aletes de pollastre',33,2,'Aletes de pollastre',1,'prod_20.png'),(21,'Patates grill',34,2,'Patates grill',1,NULL),(22,'Patates deluxe',36,2,'Patates deluxe',1,'prod_22.png'),(23,'Croquetes',15,2,'Croquetes',1,'prod_23.png'),(24,'Daus de formatge',16,2,'Daus de formatge',1,'prod_24.png'),(25,'Coca-cola',13,1.5,'Coca-cola',1,'prod_25.png'),(26,'Fanta Taronja',18,1.5,'Fanta Taronja',1,'prod_26.png'),(27,'Fanta Llimona',17,1.5,'Fanta Llimona',1,'prod_27.png'),(28,'Sprite',23,1.5,'Sprite',1,NULL),(29,'Coca-cola Ligth',14,1.5,'Coca-cola Ligth',1,'prod_29.png'),(30,'Aigua',8,1,'Aigua',1,'prod_30.png'),(31,'Nestea',22,1.5,'Nestea',1,NULL),(32,'Aquarius',12,1.5,'Aquarius',1,'prod_32.png'),(33,'Amanida Cèsar',9,3.5,'Amanida Cèsar',1,'prod_33.png'),(34,'Amanida de l\'hort',10,3.5,'Amanida de l\'hort',1,'prod_34.png'),(35,'Amanida light',11,3.5,'Amanida light',1,'prod_35.png'),(36,'Lasanya de carn',19,6,'Lasanya de carn',1,'prod_36.png'),(37,'Lasanya de verdures',20,6,'Lasanya de verdures',1,NULL),(38,'Taggliatela',24,6,'Taggliatela',1,'prod_38.png'),(39,'Macarrons',21,6,'Macarrons',1,'prod_39.png'),(41,'',5,1.5,'Gelat de xocolata',1,''),(42,'',4,1.5,'Gelat de llimona',1,''),(43,'',0,2,'Mousse de xocolata',0,''),(44,'',0,2,'Mousse de llimona',0,'');
/*!40000 ALTER TABLE `productes` ENABLE KEYS */;
UNLOCK TABLES;


LOCK TABLES `familiesrelmenus` WRITE;
/*!40000 ALTER TABLE `familiesrelmenus` DISABLE KEYS */;
INSERT INTO `familiesrelmenus` VALUES (16,1),(10,2),(18,5),(19,6);
/*!40000 ALTER TABLE `familiesrelmenus` ENABLE KEYS */;
UNLOCK TABLES;

LOCK TABLES `familiesrelproductes` WRITE;
/*!40000 ALTER TABLE `familiesrelproductes` DISABLE KEYS */;
INSERT INTO `familiesrelproductes` VALUES (10,1),(10,2),(10,3),(10,4),(10,5),(10,6),(10,7),(10,8),(16,9),(19,10),(16,11),(16,12),(16,13),(16,14),(16,15),(16,16),(16,17),(10,18),(16,19),(16,20),(16,21),(17,22),(17,23),(17,24),(11,25),(11,26),(11,27),(11,28),(11,29),(11,30),(11,31),(11,32),(18,33),(18,34),(18,35),(19,36),(19,37),(19,38),(19,39),(20,41),(20,42),(20,43),(20,44);
/*!40000 ALTER TABLE `familiesrelproductes` ENABLE KEYS */;
UNLOCK TABLES;

LOCK TABLES `menusrelproductes` WRITE;
/*!40000 ALTER TABLE `menusrelproductes` DISABLE KEYS */;
INSERT INTO `menusrelproductes` VALUES (0,20,'A'),(0,23,'A'),(0,24,'A'),(0,25,'C'),(0,26,'C'),(0,27,'C'),(0,28,'C'),(0,29,'C'),(0,30,'C'),(0,31,'C'),(0,32,'C'),(0,33,'A'),(0,34,'A'),(0,35,'A'),(0,36,'B'),(0,37,'B'),(0,38,'B'),(0,39,'B'),(1,9,'B'),(1,10,'B'),(1,11,'B'),(1,12,'B'),(1,13,'B'),(1,14,'B'),(1,15,'B'),(1,16,'B'),(1,20,'A'),(1,25,'C'),(1,26,'C'),(1,27,'C'),(1,29,'C'),(1,30,'C'),(1,32,'C'),(1,33,'A'),(1,34,'A'),(1,35,'A'),(2,1,'B'),(2,2,'B'),(2,3,'B'),(2,4,'B'),(2,5,'B'),(2,7,'B'),(2,8,'B'),(2,20,'A'),(2,23,'A'),(2,24,'A'),(2,25,'C'),(2,26,'C'),(2,27,'C'),(2,28,'C'),(2,29,'C'),(2,30,'C'),(2,31,'C'),(2,32,'C'),(2,33,'A'),(2,34,'A'),(2,35,'A'),(5,20,'A'),(5,21,'C'),(5,22,'C'),(5,23,'A'),(5,24,'A'),(5,25,'C'),(5,26,'C'),(5,27,'C'),(5,28,'C'),(5,29,'C'),(5,31,'C'),(5,33,'B'),(5,34,'B'),(5,35,'B'),(5,41,'D'),(5,42,'D'),(5,43,'D'),(5,44,'D'),(6,20,'A'),(6,21,'A'),(6,22,'A'),(6,23,'A'),(6,24,'A'),(6,25,'C'),(6,26,'C'),(6,27,'C'),(6,28,'C'),(6,29,'C'),(6,30,'C'),(6,31,'C'),(6,32,'C'),(6,33,'A'),(6,34,'A'),(6,35,'A'),(6,36,'B'),(6,37,'B'),(6,38,'B'),(6,39,'B');
/*!40000 ALTER TABLE `menusrelproductes` ENABLE KEYS */;
UNLOCK TABLES;


