-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfarmer.sql
More file actions
233 lines (194 loc) · 6.58 KB
/
farmer.sql
File metadata and controls
233 lines (194 loc) · 6.58 KB
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
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3308
-- Generation Time: Jun 21, 2021 at 11:23 PM
-- Server version: 8.0.18
-- PHP Version: 7.4.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `farmer`
--
-- --------------------------------------------------------
--
-- Table structure for table `buyer`
--
DROP TABLE IF EXISTS `buyer`;
CREATE TABLE IF NOT EXISTS `buyer` (
`bid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` text COLLATE utf8mb4_unicode_ci NOT NULL,
`role` int(11) NOT NULL,
PRIMARY KEY (`bid`),
KEY `role` (`role`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `buyer`
--
INSERT INTO `buyer` (`bid`, `username`, `email`, `password`, `role`) VALUES
(1, 'buy1', 'kevinkline02@gmail.com', '$2y$10$bVbsK54YSZ9DA05iQzj/eeTNVc6sD1r5vQQA4mSc1qSSl.BQi3fJq', 2);
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
DROP TABLE IF EXISTS `category`;
CREATE TABLE IF NOT EXISTS `category` (
`cid` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`cid`, `category_name`) VALUES
(1, 'Meat and poultry'),
(2, 'Seafood'),
(3, 'Fruit and vegetables'),
(4, 'Dairy products and eggs');
-- --------------------------------------------------------
--
-- Table structure for table `farmer`
--
DROP TABLE IF EXISTS `farmer`;
CREATE TABLE IF NOT EXISTS `farmer` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` text COLLATE utf8mb4_unicode_ci NOT NULL,
`role` int(11) NOT NULL,
PRIMARY KEY (`fid`),
KEY `role` (`role`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `farmer`
--
INSERT INTO `farmer` (`fid`, `username`, `email`, `password`, `role`) VALUES
(1, 'fam1', 'kevinkline02@gmail.com', '$2y$10$sZk2I/X/PhkNgjeLbc.kqeC718aScYIBwPJXIJI52GZM6WY6lSd52', 1);
-- --------------------------------------------------------
--
-- Table structure for table `location`
--
DROP TABLE IF EXISTS `location`;
CREATE TABLE IF NOT EXISTS `location` (
`lid` int(11) NOT NULL AUTO_INCREMENT,
`location` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`lid`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `location`
--
INSERT INTO `location` (`lid`, `location`) VALUES
(1, 'Abia'),
(2, 'Adamawa'),
(3, 'Akwa Ibom'),
(4, 'Anambra'),
(5, 'Bauchi'),
(6, 'Bayelsa'),
(7, 'Benue'),
(8, 'Borno'),
(9, 'Cross River'),
(10, 'Delta'),
(11, 'Ebonyi'),
(12, 'Edo'),
(13, 'Ekiti'),
(14, 'Enugu'),
(15, 'Federal Capital'),
(16, 'Gombe'),
(17, 'Imo'),
(18, 'Jigawa'),
(19, 'Kaduna'),
(20, 'Kano'),
(21, 'Katsina'),
(22, 'Kebbi'),
(23, 'Kogi'),
(24, 'Kwara'),
(25, 'Lagos'),
(26, 'Nasarawa'),
(27, 'Niger'),
(28, 'Ogun'),
(29, 'Ondo'),
(30, 'Osun'),
(31, 'Oyo'),
(32, 'Plateau'),
(33, 'Rivers'),
(34, 'Sokoto'),
(35, 'Taraba'),
(36, 'Yobe'),
(37, 'Zamfara');
-- --------------------------------------------------------
--
-- Table structure for table `product`
--
DROP TABLE IF EXISTS `product`;
CREATE TABLE IF NOT EXISTS `product` (
`pid` int(11) NOT NULL AUTO_INCREMENT,
`product_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`image` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`category` int(11) NOT NULL,
`location` int(11) NOT NULL,
`price` int(11) NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`date` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
`farmer_id` int(11) NOT NULL,
PRIMARY KEY (`pid`),
KEY `category` (`category`),
KEY `seller_id` (`farmer_id`),
KEY `location` (`location`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `product`
--
INSERT INTO `product` (`pid`, `product_name`, `image`, `category`, `location`, `price`, `description`, `phone`, `date`, `farmer_id`) VALUES
(1, 'cashew', 'mockup-graphics-xWRwCmhcWDM-unsplash.jpg', 2, 25, 3000, 'cheap cashew', '07085890469', '2021-06-17 00:34:29', 1),
(2, 'project', 'Activity Diagram.png', 3, 18, 6000, 'second cashew', '07017329785', '2021-06-17 00:56:01', 1),
(4, 'beef', 'beef.jpg', 1, 13, 12000, 'agro farm provides the cheapest beef in ado ekiti', '07017329785', '2021-06-20 19:32:41', 1);
-- --------------------------------------------------------
--
-- Table structure for table `role`
--
DROP TABLE IF EXISTS `role`;
CREATE TABLE IF NOT EXISTS `role` (
`rid` int(11) NOT NULL AUTO_INCREMENT,
`role` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`rid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `role`
--
INSERT INTO `role` (`rid`, `role`) VALUES
(1, 'Seller'),
(2, 'Buyer');
--
-- Constraints for dumped tables
--
--
-- Constraints for table `buyer`
--
ALTER TABLE `buyer`
ADD CONSTRAINT `buyer_ibfk_1` FOREIGN KEY (`role`) REFERENCES `role` (`rid`) ON DELETE RESTRICT ON UPDATE CASCADE;
--
-- Constraints for table `farmer`
--
ALTER TABLE `farmer`
ADD CONSTRAINT `farmer_ibfk_1` FOREIGN KEY (`role`) REFERENCES `role` (`rid`) ON DELETE RESTRICT ON UPDATE CASCADE;
--
-- Constraints for table `product`
--
ALTER TABLE `product`
ADD CONSTRAINT `product_ibfk_1` FOREIGN KEY (`category`) REFERENCES `category` (`cid`) ON DELETE RESTRICT ON UPDATE CASCADE,
ADD CONSTRAINT `product_ibfk_2` FOREIGN KEY (`farmer_id`) REFERENCES `farmer` (`fid`) ON DELETE RESTRICT ON UPDATE CASCADE,
ADD CONSTRAINT `product_ibfk_3` FOREIGN KEY (`location`) REFERENCES `location` (`lid`) ON DELETE RESTRICT ON UPDATE RESTRICT;
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 */;