-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnutritiondb.sql
210 lines (200 loc) · 6.79 KB
/
nutritiondb.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
-- #CREATE TABLE SYNTAX FOR NUTRITIONDB
-- #passed off as a deliverable for COMP 523 Software Engineering
-- +-----------------------+
-- | Tables_in_nutritiondb |
-- +-----------------------+
-- | complete_label |
-- | config |
-- | current_label |
-- | label |
-- | logged_in_user |
-- | new_label |
-- | submission |
-- | user |
-- +-----------------------+
CREATE TABLE `complete_label` (
`upc` bigint(12) unsigned zerofill NOT NULL,
`servsize` int(11) DEFAULT NULL,
`servunit` varchar(11) DEFAULT NULL,
`volquantity` int(11) DEFAULT NULL,
`volunit` varchar(11) DEFAULT NULL,
`servcontainer` int(11) DEFAULT NULL,
`calories` int(11) DEFAULT NULL,
`caloriesfat` int(11) DEFAULT NULL,
`totalfatg` decimal(3,1) DEFAULT NULL,
`totalfatdv` int(11) DEFAULT NULL,
`saturatedfatg` decimal(3,1) DEFAULT NULL,
`saturatedfatdv` int(11) DEFAULT NULL,
`transfatg` decimal(3,1) DEFAULT NULL,
`polyunsatfat` decimal(3,1) DEFAULT NULL,
`monounsatfat` decimal(3,1) DEFAULT NULL,
`cholesterolmg` int(11) DEFAULT NULL,
`cholesteroldv` int(11) DEFAULT NULL,
`sodiummg` int(11) DEFAULT NULL,
`sodiumdv` int(11) DEFAULT NULL,
`potassiummg` int(11) DEFAULT NULL,
`potassiumdv` int(11) DEFAULT NULL,
`totalcarbg` int(11) DEFAULT NULL,
`totalcarbdv` int(11) DEFAULT NULL,
`dietaryfiberg` int(11) DEFAULT NULL,
`dietaryfiberdv` int(11) DEFAULT NULL,
`sugarsg` int(11) DEFAULT NULL,
`sugarsalcoholg` int(11) DEFAULT NULL,
`othercarbg` int(11) DEFAULT NULL,
`proteing` int(11) DEFAULT NULL,
`calciumdv` int(11) DEFAULT NULL,
`irondv` int(11) DEFAULT NULL,
`vitaminadv` int(11) DEFAULT NULL,
`vitamincdv` int(11) DEFAULT NULL,
`vitaminddv` int(11) DEFAULT NULL,
`vitaminedv` int(11) DEFAULT NULL,
`vitaminb6dv` int(11) DEFAULT NULL,
`vitaminb12dv` int(11) DEFAULT NULL,
`thiamindv` int(11) DEFAULT NULL,
`riboflavindv` int(11) DEFAULT NULL,
`otherinfo` int(11) DEFAULT NULL,
`extrainfo` int(11) DEFAULT NULL,
PRIMARY KEY (`upc`)
);
CREATE TABLE `config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`count` int(11) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `current_label` (
`upc` bigint(12) unsigned zerofill NOT NULL,
`servsize` int(11) DEFAULT NULL,
`servunit` varchar(11) DEFAULT NULL,
`volquantity` int(11) DEFAULT NULL,
`volunit` varchar(11) DEFAULT NULL,
`servcontainer` int(11) DEFAULT NULL,
`calories` int(11) DEFAULT NULL,
`caloriesfat` int(11) DEFAULT NULL,
`totalfatg` decimal(3,1) DEFAULT NULL,
`totalfatdv` int(11) DEFAULT NULL,
`saturatedfatg` decimal(3,1) DEFAULT NULL,
`saturatedfatdv` int(11) DEFAULT NULL,
`transfatg` decimal(3,1) DEFAULT NULL,
`polyunsatfat` decimal(3,1) DEFAULT NULL,
`monounsatfat` decimal(3,1) DEFAULT NULL,
`cholesterolmg` int(11) DEFAULT NULL,
`cholesteroldv` int(11) DEFAULT NULL,
`sodiummg` int(11) DEFAULT NULL,
`sodiumdv` int(11) DEFAULT NULL,
`potassiummg` int(11) DEFAULT NULL,
`potassiumdv` int(11) DEFAULT NULL,
`totalcarbg` int(11) DEFAULT NULL,
`totalcarbdv` int(11) DEFAULT NULL,
`dietaryfiberg` int(11) DEFAULT NULL,
`dietaryfiberdv` int(11) DEFAULT NULL,
`sugarsg` int(11) DEFAULT NULL,
`sugarsalcoholg` int(11) DEFAULT NULL,
`othercarbg` int(11) DEFAULT NULL,
`proteing` int(11) DEFAULT NULL,
`calciumdv` int(11) DEFAULT NULL,
`irondv` int(11) DEFAULT NULL,
`vitaminadv` int(11) DEFAULT NULL,
`vitamincdv` int(11) DEFAULT NULL,
`vitaminddv` int(11) DEFAULT NULL,
`vitaminedv` int(11) DEFAULT NULL,
`vitaminb6dv` int(11) DEFAULT NULL,
`vitaminb12dv` int(11) DEFAULT NULL,
`thiamindv` int(11) DEFAULT NULL,
`riboflavindv` int(11) DEFAULT NULL,
`otherinfo` int(11) DEFAULT NULL,
`extrainfo` int(11) DEFAULT NULL,
PRIMARY KEY (`upc`)
);
CREATE TABLE `label` (
`upc` int(11) NOT NULL,
`frontimg` varchar(50) NOT NULL,
`labelimg` varchar(50) NOT NULL,
`status` varchar(10) NOT NULL,
PRIMARY KEY (`upc`)
);
CREATE TABLE `logged_in_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(15) NOT NULL,
`session_id` varchar(32) NOT NULL,
`token` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `new_label` (
`upc` bigint(12) unsigned zerofill NOT NULL,
`servsize` int(11) DEFAULT NULL,
`servunit` varchar(11) DEFAULT NULL,
`volquantity` int(11) DEFAULT NULL,
`volunit` varchar(11) DEFAULT NULL,
`servcontainer` int(11) DEFAULT NULL,
`calories` int(11) DEFAULT NULL,
`caloriesfat` int(11) DEFAULT NULL,
`totalfatg` decimal(3,1) DEFAULT NULL,
`totalfatdv` int(11) DEFAULT NULL,
`saturatedfatg` decimal(3,1) DEFAULT NULL,
`saturatedfatdv` int(11) DEFAULT NULL,
`transfatg` decimal(3,1) DEFAULT NULL,
`polyunsatfat` decimal(3,1) DEFAULT NULL,
`monounsatfat` decimal(3,1) DEFAULT NULL,
`cholesterolmg` int(11) DEFAULT NULL,
`cholesteroldv` int(11) DEFAULT NULL,
`sodiummg` int(11) DEFAULT NULL,
`sodiumdv` int(11) DEFAULT NULL,
`potassiummg` int(11) DEFAULT NULL,
`potassiumdv` int(11) DEFAULT NULL,
`totalcarbg` int(11) DEFAULT NULL,
`totalcarbdv` int(11) DEFAULT NULL,
`dietaryfiberg` int(11) DEFAULT NULL,
`dietaryfiberdv` int(11) DEFAULT NULL,
`sugarsg` int(11) DEFAULT NULL,
`sugarsalcoholg` int(11) DEFAULT NULL,
`othercarbg` int(11) DEFAULT NULL,
`proteing` int(11) DEFAULT NULL,
`calciumdv` int(11) DEFAULT NULL,
`irondv` int(11) DEFAULT NULL,
`vitaminadv` int(11) DEFAULT NULL,
`vitamincdv` int(11) DEFAULT NULL,
`vitaminddv` int(11) DEFAULT NULL,
`vitaminedv` int(11) DEFAULT NULL,
`vitaminb6dv` int(11) DEFAULT NULL,
`vitaminb12dv` int(11) DEFAULT NULL,
`thiamindv` int(11) DEFAULT NULL,
`riboflavindv` int(11) DEFAULT NULL,
`otherinfo` int(11) DEFAULT NULL,
`extrainfo` int(11) DEFAULT NULL,
PRIMARY KEY (`upc`)
);
CREATE TABLE `submission` (
`submission_id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`upc` bigint(12) unsigned zerofill NOT NULL,
`column_name` varchar(25) NOT NULL,
`column_value` varchar(25) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`submission_id`)
);
CREATE TABLE `user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`first` varchar(15) NOT NULL,
`last` varchar(15) NOT NULL,
`email` varchar(25) NOT NULL,
`password_digest` varchar(200) NOT NULL,
`admin` tinyint(4) NOT NULL,
`verification_code` varchar(50) NOT NULL,
`username` varchar(15) NOT NULL,
`verified` int(1) DEFAULT NULL,
`date_created` varchar(10) NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `username` (`username`)
);
INSERT into user VALUES(
0,
'admin',
'admin',
'admin',
'5d438cfe951ea88e079c2d11165e7bd9305401dc7013bbcb101087e7e441d17877239a64ce293e41a4a466b9fea4083603b6384b878bdb44fe3e8bdf9e745d2e',
'1',
'hpvsnk1828fqzis5gn90gr550o7wjwrhuwkar6i5isjferb',
'admin',
'1',
'2013-04-18'
);