-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.sql
executable file
·154 lines (124 loc) · 3.78 KB
/
project.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
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: db
-- Generation Time: Dec 05, 2021 at 08:15 AM
-- Server version: 8.0.27
-- PHP Version: 7.4.20
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: `project`
--
CREATE DATABASE IF NOT EXISTS `project` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
USE `project`;
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`orderID` int NOT NULL,
`productID` int NOT NULL,
`userID` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`orderID`, `productID`, `userID`) VALUES
(1, 1, 1),
(2, 1, 3);
-- --------------------------------------------------------
--
-- Table structure for table `shop`
--
CREATE TABLE `shop` (
`productID` int NOT NULL,
`userID` int NOT NULL,
`item` varchar(255) NOT NULL,
`price` float(7,2) NOT NULL,
`description` varchar(255) NOT NULL,
`quantity` int NOT NULL,
`imgPath` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
--
-- Dumping data for table `shop`
--
INSERT INTO `shop` (`productID`, `userID`, `item`, `price`, `description`, `quantity`, `imgPath`) VALUES
(1, 1, 'Lemon', 1.50, 'It\'s just a lemon', 1, 'uploads/lemon1.jpg'),
(2, 1, 'Orange', 2.00, '\'Tis just an orange', 1, 'uploads/orange1.jpg'),
(6, 1, 'Strawberry', 2.00, 'red fruit', 1, 'uploads/strawberry1.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int NOT NULL,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`password` varbinary(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, 'vendor', 0xadf3d3b3b31e413d6270b182d195c98db8ece7fba9311f76d5d7837391c91d66),
(3, 'testuser', 0xadf3d3b3b31e413d6270b182d195c98db8ece7fba9311f76d5d7837391c91d66),
(4, 'user1', 0xadf3d3b3b31e413d6270b182d195c98db8ece7fba9311f76d5d7837391c91d66);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`orderID`),
ADD KEY `fk_userid` (`userID`),
ADD KEY `fk_productid` (`productID`);
--
-- Indexes for table `shop`
--
ALTER TABLE `shop`
ADD PRIMARY KEY (`productID`),
ADD KEY `fk_userid` (`userID`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `orderID` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `shop`
--
ALTER TABLE `shop`
MODIFY `productID` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
ADD CONSTRAINT `fk_productid` FOREIGN KEY (`productID`) REFERENCES `shop` (`productID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_userid` FOREIGN KEY (`userID`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;