· 8 years ago · Jul 25, 2018, 07:22 AM
1--
2-- Table structure for table `role`
3--
4
5DROP TABLE IF EXISTS `role`;
6/*!40101 SET @saved_cs_client = @@character_set_client */;
7/*!40101 SET character_set_client = utf8 */;
8CREATE TABLE `role` (
9 `role_id` int(11) NOT NULL AUTO_INCREMENT,
10 `role` varchar(255) DEFAULT NULL,
11 PRIMARY KEY (`role_id`)
12) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
13/*!40101 SET character_set_client = @saved_cs_client */;
14
15
16--
17-- Table structure for table `user`
18--
19
20DROP TABLE IF EXISTS `account`;
21/*!40101 SET @saved_cs_client = @@character_set_client */;
22/*!40101 SET character_set_client = utf8 */;
23CREATE TABLE `account` (
24 `user_id` int(11) NOT NULL AUTO_INCREMENT,
25 `name` varchar(255) NOT NULL,
26 `surname` varchar(255) NOT NULL,
27 `email` varchar(255) NOT NULL,
28 `password` varchar(255) NOT NULL,
29 `active` int(11) DEFAULT NULL,
30 PRIMARY KEY (`user_id`)
31) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
32/*!40101 SET character_set_client = @saved_cs_client */;
33
34
35--
36-- Table structure for table `user_role`
37--
38
39DROP TABLE IF EXISTS `user_role`;
40/*!40101 SET @saved_cs_client = @@character_set_client */;
41/*!40101 SET character_set_client = utf8 */;
42CREATE TABLE `user_role` (
43 `user_id` int(11) NOT NULL,
44 `role_id` int(11) NOT NULL,
45 PRIMARY KEY (`user_id`,`role_id`),
46 KEY `FKa68196081fvovjhkek5m97n3y` (`role_id`),
47 CONSTRAINT `FK859n2jvi8ivhui0rl0esws6o` FOREIGN KEY (`user_id`) REFERENCES `account` (`user_id`),
48 CONSTRAINT `FKa68196081fvovjhkek5m97n3y` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`)
49) ENGINE=InnoDB DEFAULT CHARSET=utf8;
50/*!40101 SET character_set_client = @saved_cs_client */;
51
52INSERT INTO `role` VALUES (1,'USER');
53
54--
55-- Table structure for table `rod`
56--
57
58DROP TABLE IF EXISTS `rod`;
59/*!40101 SET @saved_cs_client = @@character_set_client */;
60/*!40101 SET character_set_client = utf8 */;
61CREATE TABLE `rod` (
62 `id` int(11) NOT NULL AUTO_INCREMENT,
63 `brand` varchar(255) NOT NULL,
64 `model` varchar(255) NOT NULL,
65 `price` int(11) DEFAULT NULL,
66 `optional_information` varchar(255) NOT NULL,
67 PRIMARY KEY (`id`)
68) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
69/*!40101 SET character_set_client = @saved_cs_client */;
70
71
72--
73-- Table structure for table `ready_meal_details`
74--
75
76DROP TABLE IF EXISTS `food_ingredient`;
77/*!40101 SET @saved_cs_client = @@character_set_client */;
78/*!40101 SET character_set_client = utf8 */;
79CREATE TABLE `food_ingredient` (
80 `id` int(11) NOT NULL AUTO_INCREMENT,
81 `name` varchar(255) NOT NULL,
82 `description` varchar(255) NOT NULL,
83 `category` int(11) DEFAULT NULL,
84 `subcategory` int(11) DEFAULT NULL,
85 `amount_protins` DOUBLE DEFAULT NULL,
86 `amount_carbs` DOUBLE DEFAULT NULL,
87 `amount_fats` DOUBLE DEFAULT NULL,
88 `created_date` TIMESTAMP NOT NULL,
89 `update_date` TIMESTAMP,
90 PRIMARY KEY (`id`)
91) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
92/*!40101 SET character_set_client = @saved_cs_client */;
93
94--
95-- Table structure for table `ready_meal`
96--
97
98DROP TABLE IF EXISTS `ready_meal`;
99/*!40101 SET @saved_cs_client = @@character_set_client */;
100/*!40101 SET character_set_client = utf8 */;
101CREATE TABLE `ready_meal` (
102 `meal_id` int(11) NOT NULL AUTO_INCREMENT,
103 `user_id` int(11) DEFAULT NULL,
104 `title` varchar(255) NOT NULL,
105 `created_date` TIMESTAMP NOT NULL,
106 `update_date` TIMESTAMP,
107 PRIMARY KEY (`meal_id`,`user_id`),
108 KEY `FK_user_id_ready_meal_account_34twegah` (`user_id`),
109 CONSTRAINT `FK_user_id_ready_meal_account_34twegah` FOREIGN KEY (`user_id`) REFERENCES `account` (`user_id`)
110) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
111/*!40101 SET character_set_client = @saved_cs_client */;
112
113--
114-- Table structure for table `ready_meal_details`
115--
116
117DROP TABLE IF EXISTS `ready_meal_details`;
118/*!40101 SET @saved_cs_client = @@character_set_client */;
119/*!40101 SET character_set_client = utf8 */;
120CREATE TABLE `ready_meal_details` (
121 `id` int(11) NOT NULL AUTO_INCREMENT,
122 `meal_id` int(11) DEFAULT NULL,
123 `food_ingredient_id` int(11) DEFAULT NULL,
124 `grams_portion` int(11) DEFAULT NULL,
125 PRIMARY KEY (`id`),
126 KEY `FK_ready_meal_id_ready_meal_details_34twegah` (`meal_id`),
127 CONSTRAINT `FK_ready_meal_id_ready_meal_details_34twegah` FOREIGN KEY (`meal_id`) REFERENCES `ready_meal` (`meal_id`),
128 CONSTRAINT `FK_calorie_id_food_ingredient` FOREIGN KEY (`food_ingredient_id`) REFERENCES `food_ingredient` (`id`)
129) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
130/*!40101 SET character_set_client = @saved_cs_client */;
131
132
133--
134-- Table structure for table `ready_meal_details`
135--
136
137DROP TABLE IF EXISTS `calorie_calculator`;
138/*!40101 SET @saved_cs_client = @@character_set_client */;
139/*!40101 SET character_set_client = utf8 */;
140CREATE TABLE `calorie_calculator` (
141 `id` int(11) NOT NULL AUTO_INCREMENT,
142 `sex` int(11) DEFAULT NULL,
143 `weight` int(11) DEFAULT NULL,
144 `height` int(11) DEFAULT NULL,
145 `age` int(11) DEFAULT NULL,
146 `planned_effort` int(11) DEFAULT NULL,
147 `body_goal` int(11) DEFAULT NULL,
148 `user_id` int(11) DEFAULT NULL,
149 `body_type` int(11) DEFAULT NULL,
150 `calories_demand` int(11) DEFAULT NULL,
151 `created_date` TIMESTAMP NOT NULL,
152 `update_date` TIMESTAMP,
153 KEY `FK_user_id_calorie_calculator` (`user_id`),
154 CONSTRAINT `FK_user_id_calorie_calculator` FOREIGN KEY (`user_id`) REFERENCES `account` (`user_id`),
155
156 PRIMARY KEY (`id`)
157) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
158/*!40101 SET character_set_client = @saved_cs_client */;