-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructure.sql
282 lines (233 loc) · 8.63 KB
/
structure.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!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 utf8mb4 */;
--
-- Database: `growTENT`
--
CREATE DATABASE IF NOT EXISTS `growTENT` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `growTENT`;
-- --------------------------------------------------------
--
-- Table structure for table `cultivars`
--
CREATE TABLE `cultivars` (
`id` int NOT NULL,
`cultivar_name` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`expected_thc` int NOT NULL,
`expected_cbd` int NOT NULL,
`expected_flowertime` varchar(32) COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `facilities`
--
CREATE TABLE `facilities` (
`id` int NOT NULL,
`facilityname` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`approved_for_cultivation` varchar(16) COLLATE utf8mb4_general_ci NOT NULL,
`max_flowers` varchar(16) COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `inventory`
--
CREATE TABLE `inventory` (
`id` int NOT NULL,
`facilityid` int NOT NULL,
`facilityname` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`date_of_spawn` date NOT NULL COMMENT 'What was the date of spawn, either cutting day or date the seed popped',
`date_of_harvest` date DEFAULT NULL COMMENT 'What day did we harvest the plant?',
`date_of_pack` date DEFAULT NULL COMMENT 'What day was it packed, after drying / curing?',
`date_of_disposal` date DEFAULT NULL,
`date_of_lastmove` date DEFAULT NULL,
`date_prop_nursery` date DEFAULT NULL,
`date_nursery_vege` date DEFAULT NULL,
`date_vege_flower` date DEFAULT NULL,
`mother_uniqueid` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
`plant_uniqueid` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
`season_id` varchar(8) COLLATE utf8mb4_general_ci NOT NULL,
`plant_num` int NOT NULL,
`where_is_it_now` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`harvest_ww` int DEFAULT NULL COMMENT 'Harvest wet weight (grams)',
`harvest_dw` int DEFAULT NULL COMMENT 'Harvest dry weight (grams). If 0, we will provide it later. If null, we won''t provide one',
`current_state` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`cultivar` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`is_alive` int NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `nutrients`
--
CREATE TABLE `nutrients` (
`seasonid` varchar(8) COLLATE utf8mb4_general_ci NOT NULL,
`reservoir` int NOT NULL,
`amount` int NOT NULL,
`ecstrength` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `plant_notes`
--
CREATE TABLE `plant_notes` (
`id` int NOT NULL,
`plant_uniqueid` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
`note_date` date NOT NULL,
`notes` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `seasons`
--
CREATE TABLE `seasons` (
`seasonid` int NOT NULL,
`year` year NOT NULL,
`season_number` int NOT NULL,
`cultivarid` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `shipping`
--
CREATE TABLE `shipping` (
`name_of_preparer` varchar(128) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Name of staff preparing shipment',
`email_for_notifications` varchar(256) COLLATE utf8mb4_general_ci NOT NULL,
`date_of_preparation` date NOT NULL COMMENT 'Date prepared for shipping',
`time_of_preparation` time NOT NULL COMMENT 'Time prepared for shipping',
`product_type` varchar(128) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Product type (eg cutting, plant, wet flower, dry flower etc)\r\n*',
`number_being_shipped` int NOT NULL COMMENT '# of bags / plants / containers',
`total_weight` int NOT NULL COMMENT 'Total shipment weight (if applicable) excl packaging',
`total_weight_incl_packaging` int NOT NULL COMMENT 'Total weight including packaging, either / or to be used',
`recipient_name` varchar(256) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Receipient name / company',
`destination_address` text COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Destination address',
`collected_by` varchar(256) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Collected from facility by',
`date_of_collection` date NOT NULL COMMENT 'Date of collection',
`time_of_collection` time NOT NULL COMMENT 'Time of collection',
`number_collected` int NOT NULL COMMENT '# of bags / plants / containers collected',
`received_by` varchar(256) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Received by (name)',
`date_of_receipt` date NOT NULL COMMENT 'Date of receipt',
`time_of_receipt` time NOT NULL COMMENT 'Time of receipt',
`number collected` int NOT NULL COMMENT '# of bags / plants / containers collected',
`confirmed_delivery_matched` int NOT NULL COMMENT '0 unset, 1 is matched, 2 is unmatched',
`uniqueid` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `treatments`
--
CREATE TABLE `treatments` (
`id` int NOT NULL,
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`room` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
`action_taken` varchar(128) COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `visitors`
--
CREATE TABLE `visitors` (
`id` int NOT NULL,
`Name` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`Phone` varchar(24) COLLATE utf8mb4_general_ci NOT NULL,
`Purpose` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`EscortedBy` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`TimeIn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`haz_light` int NOT NULL,
`haz_co2` int NOT NULL,
`haz_gloves` int NOT NULL,
`haz_flame` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cultivars`
--
ALTER TABLE `cultivars`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`);
--
-- Indexes for table `facilities`
--
ALTER TABLE `facilities`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `inventory`
--
ALTER TABLE `inventory`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `plant_notes`
--
ALTER TABLE `plant_notes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `seasons`
--
ALTER TABLE `seasons`
ADD PRIMARY KEY (`seasonid`);
--
-- Indexes for table `shipping`
--
ALTER TABLE `shipping`
ADD PRIMARY KEY (`uniqueid`,`date_of_preparation`);
--
-- Indexes for table `treatments`
--
ALTER TABLE `treatments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `visitors`
--
ALTER TABLE `visitors`
ADD UNIQUE KEY `id` (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cultivars`
--
ALTER TABLE `cultivars`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `facilities`
--
ALTER TABLE `facilities`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `inventory`
--
ALTER TABLE `inventory`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `plant_notes`
--
ALTER TABLE `plant_notes`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `seasons`
--
ALTER TABLE `seasons`
MODIFY `seasonid` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `shipping`
--
ALTER TABLE `shipping`
MODIFY `uniqueid` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `treatments`
--
ALTER TABLE `treatments`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `visitors`
--
ALTER TABLE `visitors`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
COMMIT;
/*!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 */;