· 6 years ago · Dec 15, 2019, 09:46 AM
1-- MySQL dump 10.13 Distrib 8.0.18, for Win64 (x86_64)
2--
3-- Host: localhost Database: plant service
4-- ------------------------------------------------------
5-- Server version 8.0.18
6
7/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10/*!50503 SET NAMES utf8 */;
11/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12/*!40103 SET TIME_ZONE='+00:00' */;
13/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
18--
19-- Table structure for table `cities`
20--
21
22DROP TABLE IF EXISTS `cities`;
23/*!40101 SET @saved_cs_client = @@character_set_client */;
24/*!50503 SET character_set_client = utf8mb4 */;
25CREATE TABLE `cities` (
26 `id` int(11) NOT NULL AUTO_INCREMENT,
27 `name` varchar(30) NOT NULL,
28 `country_name` varchar(80) NOT NULL,
29 PRIMARY KEY (`id`)
30) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=utf8;
31/*!40101 SET character_set_client = @saved_cs_client */;
32
33--
34-- Table structure for table `info_plants`
35--
36
37DROP TABLE IF EXISTS `info_plants`;
38/*!40101 SET @saved_cs_client = @@character_set_client */;
39/*!50503 SET character_set_client = utf8mb4 */;
40CREATE TABLE `info_plants` (
41 `id` int(11) NOT NULL,
42 `plant_id` int(11) NOT NULL,
43 `family` varchar(50) NOT NULL,
44 `genus` varchar(40) NOT NULL,
45 `purpose` varchar(60) DEFAULT NULL,
46 PRIMARY KEY (`id`),
47 KEY `FK_PLANT_idx` (`plant_id`),
48 CONSTRAINT `FK_PLANT` FOREIGN KEY (`plant_id`) REFERENCES `plants` (`id`)
49) ENGINE=InnoDB DEFAULT CHARSET=utf8;
50/*!40101 SET character_set_client = @saved_cs_client */;
51
52--
53-- Table structure for table `orders`
54--
55
56DROP TABLE IF EXISTS `orders`;
57/*!40101 SET @saved_cs_client = @@character_set_client */;
58/*!50503 SET character_set_client = utf8mb4 */;
59CREATE TABLE `orders` (
60 `id` int(11) NOT NULL AUTO_INCREMENT,
61 `user_id` int(11) NOT NULL,
62 `order_date` date NOT NULL,
63 `is_completed` tinyint(1) DEFAULT '0',
64 PRIMARY KEY (`id`),
65 KEY `FK_USER_idx` (`user_id`),
66 CONSTRAINT `FK_USER` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
67) ENGINE=InnoDB AUTO_INCREMENT=928 DEFAULT CHARSET=utf8;
68/*!40101 SET character_set_client = @saved_cs_client */;
69
70--
71-- Table structure for table `plant_orders`
72--
73
74DROP TABLE IF EXISTS `plant_orders`;
75/*!40101 SET @saved_cs_client = @@character_set_client */;
76/*!50503 SET character_set_client = utf8mb4 */;
77CREATE TABLE `plant_orders` (
78 `plant_id` int(11) NOT NULL,
79 `order_id` int(11) NOT NULL,
80 KEY `FK_PLANT1_idx` (`plant_id`),
81 KEY `FK_ORDER1_idx` (`order_id`),
82 CONSTRAINT `FK_ORDER1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
83 CONSTRAINT `FK_PLANT1` FOREIGN KEY (`plant_id`) REFERENCES `plants` (`id`)
84) ENGINE=InnoDB DEFAULT CHARSET=utf8;
85/*!40101 SET character_set_client = @saved_cs_client */;
86
87--
88-- Table structure for table `plants`
89--
90
91DROP TABLE IF EXISTS `plants`;
92/*!40101 SET @saved_cs_client = @@character_set_client */;
93/*!50503 SET character_set_client = utf8mb4 */;
94CREATE TABLE `plants` (
95 `id` int(11) NOT NULL AUTO_INCREMENT,
96 `name` varchar(50) NOT NULL,
97 `price` decimal(15,5) NOT NULL,
98 `color` varchar(50) DEFAULT NULL,
99 `quantity` int(11) DEFAULT '0',
100 PRIMARY KEY (`id`)
101) ENGINE=InnoDB AUTO_INCREMENT=847 DEFAULT CHARSET=utf8;
102/*!40101 SET character_set_client = @saved_cs_client */;
103
104--
105-- Table structure for table `users`
106--
107
108DROP TABLE IF EXISTS `users`;
109/*!40101 SET @saved_cs_client = @@character_set_client */;
110/*!50503 SET character_set_client = utf8mb4 */;
111CREATE TABLE `users` (
112 `id` int(11) NOT NULL AUTO_INCREMENT,
113 `username` varchar(50) NOT NULL,
114 `password` varchar(225) NOT NULL,
115 `first_name` varchar(50) NOT NULL,
116 `last_name` varchar(50) DEFAULT NULL,
117 `age` int(11) NOT NULL,
118 `money` decimal(15,2) NOT NULL,
119 `city_id` int(11) NOT NULL,
120 `register_date` date NOT NULL,
121 PRIMARY KEY (`id`),
122 KEY `FK_CITY_idx` (`city_id`),
123 CONSTRAINT `FK_CITY` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`)
124) ENGINE=InnoDB AUTO_INCREMENT=754 DEFAULT CHARSET=utf8;
125/*!40101 SET character_set_client = @saved_cs_client */;
126/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
127
128/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
129/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
130/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
131/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
132/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
133/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
134/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
135
136-- Dump completed on 2019-12-15 11:42:23