CREATE DATABASE IF NOT EXISTS `flavours_without_borders` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `flavours_without_borders`; -- MySQL dump 10.13 Distrib 5.7.24, for Linux (x86_64) -- -- Host: 127.0.0.1 Database: flavours_without_borders -- ------------------------------------------------------ -- Server version 5.7.24-0ubuntu0.18.04.1 /*!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 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `diet` -- DROP TABLE IF EXISTS `diet`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `diet` ( `diet_id` int(11) NOT NULL, `diet_name` varchar(200) NOT NULL, `diet_description` varchar(150) DEFAULT NULL, `diet_is_approved` bit(1) DEFAULT b'0', PRIMARY KEY (`diet_id`), UNIQUE KEY `diet_id_UNIQUE` (`diet_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `diet` -- LOCK TABLES `diet` WRITE; /*!40000 ALTER TABLE `diet` DISABLE KEYS */; /*!40000 ALTER TABLE `diet` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `diet_prohibits_ingredient` -- DROP TABLE IF EXISTS `diet_prohibits_ingredient`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `diet_prohibits_ingredient` ( `diet_id` int(11) NOT NULL, `ingredient_name` varchar(200) NOT NULL, PRIMARY KEY (`diet_id`,`ingredient_name`), KEY `diet_prohibits_ingredient_name_idx` (`ingredient_name`), CONSTRAINT `diet_prohibits_has_diet_id` FOREIGN KEY (`diet_id`) REFERENCES `diet` (`diet_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `diet_prohibits_ingredient_name` FOREIGN KEY (`ingredient_name`) REFERENCES `ingredient` (`ingredient_name`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `diet_prohibits_ingredient` -- LOCK TABLES `diet_prohibits_ingredient` WRITE; /*!40000 ALTER TABLE `diet_prohibits_ingredient` DISABLE KEYS */; /*!40000 ALTER TABLE `diet_prohibits_ingredient` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `drink` -- DROP TABLE IF EXISTS `drink`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `drink` ( `drink_id` int(11) NOT NULL, `drink_name` varchar(200) NOT NULL, `drink_description` varchar(150) DEFAULT NULL, `drink_is_approved` bit(1) DEFAULT b'0', `restaurant_id` int(11) NOT NULL, PRIMARY KEY (`drink_id`), UNIQUE KEY `drink_id_UNIQUE` (`drink_id`), KEY `food_is_offered_by_restaurant_id_idx` (`restaurant_id`), CONSTRAINT `drink_is_offered_by_restaurant_id` FOREIGN KEY (`restaurant_id`) REFERENCES `restaurant` (`restaurant_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `drink` -- LOCK TABLES `drink` WRITE; /*!40000 ALTER TABLE `drink` DISABLE KEYS */; /*!40000 ALTER TABLE `drink` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `drink_has_ingredient` -- DROP TABLE IF EXISTS `drink_has_ingredient`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `drink_has_ingredient` ( `drink_id` int(11) NOT NULL, `ingredient_name` varchar(200) NOT NULL, PRIMARY KEY (`drink_id`,`ingredient_name`), KEY `ingredient_name_idx` (`ingredient_name`), CONSTRAINT `drink_has_drink_id` FOREIGN KEY (`drink_id`) REFERENCES `drink` (`drink_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `drink_has_ingredient_name` FOREIGN KEY (`ingredient_name`) REFERENCES `ingredient` (`ingredient_name`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `drink_has_ingredient` -- LOCK TABLES `drink_has_ingredient` WRITE; /*!40000 ALTER TABLE `drink_has_ingredient` DISABLE KEYS */; /*!40000 ALTER TABLE `drink_has_ingredient` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `food` -- DROP TABLE IF EXISTS `food`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `food` ( `food_id` int(11) NOT NULL, `food_name` varchar(200) NOT NULL, `food_description` varchar(150) DEFAULT NULL, `food_calories` int(11) DEFAULT NULL, `food_is_approved` varchar(45) DEFAULT '0', `restaurant_id` int(11) NOT NULL, PRIMARY KEY (`food_id`), UNIQUE KEY `food_id_UNIQUE` (`food_id`), KEY `food_is_offered_by_restaurant_id_idx` (`restaurant_id`), CONSTRAINT `food_is_offered_by_restaurant_id` FOREIGN KEY (`restaurant_id`) REFERENCES `restaurant` (`restaurant_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `food` -- LOCK TABLES `food` WRITE; /*!40000 ALTER TABLE `food` DISABLE KEYS */; /*!40000 ALTER TABLE `food` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `food_has_ingredient` -- DROP TABLE IF EXISTS `food_has_ingredient`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `food_has_ingredient` ( `food_id` int(11) NOT NULL, `ingredient_name` varchar(200) NOT NULL, PRIMARY KEY (`food_id`,`ingredient_name`), KEY `ingredient_name_idx` (`ingredient_name`), CONSTRAINT `food_has_food_id` FOREIGN KEY (`food_id`) REFERENCES `food` (`food_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `food_has_ingredient_name` FOREIGN KEY (`ingredient_name`) REFERENCES `ingredient` (`ingredient_name`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `food_has_ingredient` -- LOCK TABLES `food_has_ingredient` WRITE; /*!40000 ALTER TABLE `food_has_ingredient` DISABLE KEYS */; /*!40000 ALTER TABLE `food_has_ingredient` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ingredient` -- DROP TABLE IF EXISTS `ingredient`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ingredient` ( `ingredient_name` varchar(200) NOT NULL, `ingredient_has_alcohol` bit(1) DEFAULT b'0', PRIMARY KEY (`ingredient_name`), UNIQUE KEY `ingredient_name_UNIQUE` (`ingredient_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ingredient` -- LOCK TABLES `ingredient` WRITE; /*!40000 ALTER TABLE `ingredient` DISABLE KEYS */; /*!40000 ALTER TABLE `ingredient` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `permission` -- DROP TABLE IF EXISTS `permission`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `permission` ( `permission_id` int(11) NOT NULL, `permission_description` varchar(45) NOT NULL, PRIMARY KEY (`permission_id`), UNIQUE KEY `permission_id_UNIQUE` (`permission_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `permission` -- LOCK TABLES `permission` WRITE; /*!40000 ALTER TABLE `permission` DISABLE KEYS */; /*!40000 ALTER TABLE `permission` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `restaurant` -- DROP TABLE IF EXISTS `restaurant`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `restaurant` ( `restaurant_id` int(11) NOT NULL, `restaurant_name` varchar(200) NOT NULL, `restaurant_category` enum('cafeteria','pub','bar','restaurant','fast_food','ethnic') NOT NULL, `restaurant_longitude` float NOT NULL, `restaurant_latitude` float NOT NULL, `restaurant_opening` time DEFAULT NULL, `restaurant_closing` time DEFAULT NULL, `restaurant_is_approved` bit(1) DEFAULT b'0' COMMENT 'Ίσως πρέπει να γίνει NN και να φύγει το default;', `user_id` int(11) DEFAULT NULL, PRIMARY KEY (`restaurant_id`), UNIQUE KEY `restaurant_id_UNIQUE` (`restaurant_id`), KEY `restaurant_is_owned_by_user_id_idx` (`user_id`), CONSTRAINT `restaurant_is_owned_by_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `restaurant` -- LOCK TABLES `restaurant` WRITE; /*!40000 ALTER TABLE `restaurant` DISABLE KEYS */; /*!40000 ALTER TABLE `restaurant` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `role` -- DROP TABLE IF EXISTS `role`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `role` ( `role_id` int(11) NOT NULL, `role_name` varchar(200) NOT NULL, `role_description` varchar(150) NOT NULL, PRIMARY KEY (`role_id`), UNIQUE KEY `role_id_UNIQUE` (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `role` -- LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `role_has_permission` -- DROP TABLE IF EXISTS `role_has_permission`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `role_has_permission` ( `role_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, PRIMARY KEY (`role_id`,`permission_id`), KEY `role_has_permission_id_idx` (`permission_id`), CONSTRAINT `role_has_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `permission` (`permission_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `role_has_permission_role_id` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `role_has_permission` -- LOCK TABLES `role_has_permission` WRITE; /*!40000 ALTER TABLE `role_has_permission` DISABLE KEYS */; /*!40000 ALTER TABLE `role_has_permission` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user` -- DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user` ( `user_id` int(11) NOT NULL, `user_email` varchar(500) NOT NULL, `user_username` varchar(200) NOT NULL, `user_hashed_password` char(64) NOT NULL, `user_salt` char(32) NOT NULL, `role_id` int(11) NOT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `user_id_UNIQUE` (`user_id`), KEY `user_is_role_id_idx` (`role_id`), CONSTRAINT `user_is_role_id` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user` -- LOCK TABLES `user` WRITE; /*!40000 ALTER TABLE `user` DISABLE KEYS */; /*!40000 ALTER TABLE `user` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user_follows_diet` -- DROP TABLE IF EXISTS `user_follows_diet`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_follows_diet` ( `user_id` int(11) NOT NULL, `diet_id` int(11) NOT NULL, PRIMARY KEY (`user_id`,`diet_id`), KEY `user_follows_diet_id_idx` (`diet_id`), CONSTRAINT `user_follows_diet_id` FOREIGN KEY (`diet_id`) REFERENCES `diet` (`diet_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `user_follows_has_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user_follows_diet` -- LOCK TABLES `user_follows_diet` WRITE; /*!40000 ALTER TABLE `user_follows_diet` DISABLE KEYS */; /*!40000 ALTER TABLE `user_follows_diet` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user_prohibits_ingredient` -- DROP TABLE IF EXISTS `user_prohibits_ingredient`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_prohibits_ingredient` ( `user_id` int(11) NOT NULL, `ingredient_name` varchar(200) NOT NULL, PRIMARY KEY (`user_id`,`ingredient_name`), KEY `user_prohibits_ingredient_name_idx` (`ingredient_name`), CONSTRAINT `user_prohibits_has_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `user_prohibits_ingredient_name` FOREIGN KEY (`ingredient_name`) REFERENCES `ingredient` (`ingredient_name`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user_prohibits_ingredient` -- LOCK TABLES `user_prohibits_ingredient` WRITE; /*!40000 ALTER TABLE `user_prohibits_ingredient` DISABLE KEYS */; /*!40000 ALTER TABLE `user_prohibits_ingredient` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user_rates_drink` -- DROP TABLE IF EXISTS `user_rates_drink`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_rates_drink` ( `user_id` int(11) NOT NULL, `drink_id` int(11) NOT NULL, `rating_grade` int(11) NOT NULL, `rating_date` date NOT NULL, `rating_text` varchar(150) DEFAULT NULL, `rating_pοrtion_size` enum('small','medium','big') DEFAULT NULL, PRIMARY KEY (`user_id`,`drink_id`), KEY `user_rates_drink_id_idx` (`drink_id`), CONSTRAINT `user_rates_drink_has_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `user_rates_drink_id` FOREIGN KEY (`drink_id`) REFERENCES `drink` (`drink_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user_rates_drink` -- LOCK TABLES `user_rates_drink` WRITE; /*!40000 ALTER TABLE `user_rates_drink` DISABLE KEYS */; /*!40000 ALTER TABLE `user_rates_drink` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user_rates_food` -- DROP TABLE IF EXISTS `user_rates_food`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_rates_food` ( `user_id` int(11) NOT NULL, `food_id` int(11) NOT NULL, `rating_grade` int(11) NOT NULL, `rating_date` date NOT NULL, `rating_text` varchar(150) DEFAULT NULL, `rating_pοrtion_size` enum('small','medium','big') DEFAULT NULL, PRIMARY KEY (`user_id`,`food_id`), KEY `user_rates_food_id_idx` (`food_id`), CONSTRAINT `user_rates_food_has_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `user_rates_food_id` FOREIGN KEY (`food_id`) REFERENCES `food` (`food_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user_rates_food` -- LOCK TABLES `user_rates_food` WRITE; /*!40000 ALTER TABLE `user_rates_food` DISABLE KEYS */; /*!40000 ALTER TABLE `user_rates_food` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user_rates_restaurant` -- DROP TABLE IF EXISTS `user_rates_restaurant`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_rates_restaurant` ( `user_id` int(11) NOT NULL, `restaurant_id` int(11) NOT NULL, `diet_id` int(11) DEFAULT NULL, `rating_grade` int(11) NOT NULL, `rating_date` date NOT NULL, `rating_text` varchar(150) DEFAULT NULL, PRIMARY KEY (`user_id`,`restaurant_id`), KEY `user_rates_restaurant_id_idx` (`restaurant_id`), KEY `user_rates_restaurant_with_diet_id_idx` (`diet_id`), CONSTRAINT `user_rates_restaurant_has_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `user_rates_restaurant_id` FOREIGN KEY (`restaurant_id`) REFERENCES `restaurant` (`restaurant_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `user_rates_restaurant_with_diet_id` FOREIGN KEY (`diet_id`) REFERENCES `diet` (`diet_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user_rates_restaurant` -- LOCK TABLES `user_rates_restaurant` WRITE; /*!40000 ALTER TABLE `user_rates_restaurant` DISABLE KEYS */; /*!40000 ALTER TABLE `user_rates_restaurant` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-11-27 12:59:34