-
Notifications
You must be signed in to change notification settings - Fork 0
/
sepatu_db2.sql
320 lines (261 loc) · 8.16 KB
/
sepatu_db2.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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 20, 2022 at 06:59 PM
-- Server version: 10.4.24-MariaDB
-- PHP Version: 8.1.6
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: `sepatu_db2`
--
-- --------------------------------------------------------
--
-- Table structure for table `brand`
--
CREATE TABLE `brand` (
`id_brand` int(11) NOT NULL,
`nama_brand` varchar(30) NOT NULL,
`jenis` varchar(20) NOT NULL,
`asal` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `brand`
--
INSERT INTO `brand` (`id_brand`, `nama_brand`, `jenis`, `asal`) VALUES
(1, 'Vans', 'Sneakers', 'Import'),
(2, 'Compass', 'Sneakers', 'Lokal'),
(3, 'Ventela', 'Sneakers', 'Lokal'),
(4, 'Patrobas', 'Slip On', 'Lokal'),
(5, 'FYC Footwear', 'Loafers', 'Lokal');
-- --------------------------------------------------------
--
-- Table structure for table `keys`
--
CREATE TABLE `keys` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`key` varchar(40) NOT NULL,
`level` int(2) NOT NULL,
`ignore_limits` tinyint(1) NOT NULL DEFAULT 0,
`is_private_key` tinyint(1) NOT NULL DEFAULT 0,
`ip_addresses` text DEFAULT NULL,
`date_created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `keys`
--
INSERT INTO `keys` (`id`, `user_id`, `key`, `level`, `ignore_limits`, `is_private_key`, `ip_addresses`, `date_created`) VALUES
(1, 1, 'root', 1, 0, 0, NULL, 1);
-- --------------------------------------------------------
--
-- Table structure for table `laporan`
--
CREATE TABLE `laporan` (
`id_laporan` int(11) NOT NULL,
`id_transaksi` int(11) NOT NULL,
`tgl_laporan` date NOT NULL,
`jumlah` int(10) NOT NULL,
`harga` int(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `limits`
--
CREATE TABLE `limits` (
`id` int(11) NOT NULL,
`uri` varchar(255) NOT NULL,
`count` int(10) NOT NULL,
`hour_started` int(11) NOT NULL,
`api_key` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `limits`
--
INSERT INTO `limits` (`id`, `uri`, `count`, `hour_started`, `api_key`) VALUES
(1, 'uri:API/sepatu/sepatu:get', 52, 1658334091, 'root'),
(2, 'uri:API/sepatu/sepatu:post', 1, 1658334971, 'root'),
(3, 'uri:API/sepatu/sepatu:put', 2, 1658334989, 'root'),
(4, 'uri:API/sepatu/sepatu:delete', 3, 1658334909, 'root'),
(5, 'uri:API/pemasok/pemasok:get', 3, 1658329221, 'root'),
(6, 'uri:API/pemasok/pemasok:post', 3, 1658170133, 'root'),
(7, 'uri:API/pemasok/pemasok:put', 2, 1658170336, 'root'),
(8, 'uri:API/pemasok/pemasok:delete', 3, 1658170439, 'root'),
(9, 'uri:API/brand/brand:get', 8, 1658336096, 'root'),
(10, 'uri:API/brand/brand:post', 1, 1658336116, 'root'),
(11, 'uri:API/brand/brand:put', 1, 1658336210, 'root'),
(12, 'uri:API/brand/brand:delete', 1, 1658336221, 'root');
-- --------------------------------------------------------
--
-- Table structure for table `pelanggan`
--
CREATE TABLE `pelanggan` (
`id_pelanggan` int(11) NOT NULL,
`nama` varchar(30) NOT NULL,
`alamat` varchar(100) NOT NULL,
`no_hp` int(30) NOT NULL,
`username` varchar(10) NOT NULL,
`password` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `pemasok`
--
CREATE TABLE `pemasok` (
`id_pemasok` int(11) NOT NULL,
`nama_pemasok` varchar(30) NOT NULL,
`alamat_pemasok` varchar(100) NOT NULL,
`no_hp` int(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `pemasok`
--
INSERT INTO `pemasok` (`id_pemasok`, `nama_pemasok`, `alamat_pemasok`, `no_hp`) VALUES
(1, 'Paul Van Doren', 'New York', 628957463),
(2, 'Kahar Gunawan', 'Bandung', 627463463),
(3, 'William Ventela', 'Bandung', 628952536),
(4, 'Sebastian Surya Sutantio', 'Bogor', 628777463),
(5, 'Ucay', 'Jakarta', 628557463);
-- --------------------------------------------------------
--
-- Table structure for table `pembayaran`
--
CREATE TABLE `pembayaran` (
`id_pembayaran` int(11) NOT NULL,
`no_nota` int(11) NOT NULL,
`metode_bayar` varchar(20) NOT NULL,
`harga` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `sepatu`
--
CREATE TABLE `sepatu` (
`id_sepatu` int(11) NOT NULL,
`id_brand` int(11) NOT NULL,
`id_pemasok` int(11) NOT NULL,
`bahan` varchar(30) NOT NULL,
`ukuran` int(5) NOT NULL,
`stok` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `sepatu`
--
INSERT INTO `sepatu` (`id_sepatu`, `id_brand`, `id_pemasok`, `bahan`, `ukuran`, `stok`) VALUES
(1, 1, 1, 'Canvas', 39, 500),
(2, 2, 2, 'Denim', 40, 450),
(3, 3, 3, 'Jeans', 35, 210),
(4, 4, 4, 'Kulit Nubuck', 41, 300),
(5, 5, 5, 'Kulit Sintetis', 42, 400);
-- --------------------------------------------------------
--
-- Table structure for table `transaksi`
--
CREATE TABLE `transaksi` (
`id_transaksi` int(11) NOT NULL,
`id_pelanggan` int(11) NOT NULL,
`id_sepatu` int(11) NOT NULL,
`id_pembayaran` int(11) NOT NULL,
`tgl_transaksi` date NOT NULL,
`diskon` int(10) NOT NULL,
`keterangan` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `brand`
--
ALTER TABLE `brand`
ADD PRIMARY KEY (`id_brand`);
--
-- Indexes for table `keys`
--
ALTER TABLE `keys`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `laporan`
--
ALTER TABLE `laporan`
ADD PRIMARY KEY (`id_laporan`),
ADD KEY `id_transaksi` (`id_transaksi`);
--
-- Indexes for table `limits`
--
ALTER TABLE `limits`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pelanggan`
--
ALTER TABLE `pelanggan`
ADD PRIMARY KEY (`id_pelanggan`);
--
-- Indexes for table `pemasok`
--
ALTER TABLE `pemasok`
ADD PRIMARY KEY (`id_pemasok`);
--
-- Indexes for table `pembayaran`
--
ALTER TABLE `pembayaran`
ADD PRIMARY KEY (`id_pembayaran`);
--
-- Indexes for table `sepatu`
--
ALTER TABLE `sepatu`
ADD PRIMARY KEY (`id_sepatu`),
ADD KEY `id_pemasok` (`id_pemasok`),
ADD KEY `id_brand` (`id_brand`);
--
-- Indexes for table `transaksi`
--
ALTER TABLE `transaksi`
ADD PRIMARY KEY (`id_transaksi`),
ADD KEY `id_pelanggan` (`id_pelanggan`),
ADD KEY `id_sepatu` (`id_sepatu`),
ADD KEY `id_pembayaran` (`id_pembayaran`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `keys`
--
ALTER TABLE `keys`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `limits`
--
ALTER TABLE `limits`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `laporan`
--
ALTER TABLE `laporan`
ADD CONSTRAINT `laporan_ibfk_1` FOREIGN KEY (`id_transaksi`) REFERENCES `transaksi` (`id_transaksi`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `sepatu`
--
ALTER TABLE `sepatu`
ADD CONSTRAINT `sepatu_ibfk_1` FOREIGN KEY (`id_pemasok`) REFERENCES `pemasok` (`id_pemasok`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `sepatu_ibfk_2` FOREIGN KEY (`id_brand`) REFERENCES `brand` (`id_brand`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `transaksi`
--
ALTER TABLE `transaksi`
ADD CONSTRAINT `transaksi_ibfk_1` FOREIGN KEY (`id_pembayaran`) REFERENCES `pembayaran` (`id_pembayaran`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `transaksi_ibfk_2` FOREIGN KEY (`id_pelanggan`) REFERENCES `pelanggan` (`id_pelanggan`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `transaksi_ibfk_3` FOREIGN KEY (`id_sepatu`) REFERENCES `sepatu` (`id_sepatu`) 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 */;