-
Notifications
You must be signed in to change notification settings - Fork 1
/
databaseinventory.sql
407 lines (339 loc) · 11.4 KB
/
databaseinventory.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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Mar 03, 2024 at 04:57 PM
-- Server version: 10.4.32-MariaDB-log
-- PHP Version: 8.0.3
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: `databaseinventory`
--
CREATE DATABASE IF NOT EXISTS `databaseinventory` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `databaseinventory`;
-- --------------------------------------------------------
--
-- Table structure for table `bahan_produksi`
--
CREATE TABLE `bahan_produksi` (
`ID` int(6) NOT NULL,
`produk` varchar(30) NOT NULL,
`nama_bahan` varchar(255) NOT NULL,
`quantity` int(6) NOT NULL,
`harga_bahan` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `client`
--
CREATE TABLE `client` (
`client_id` int(6) NOT NULL,
`nama_client` varchar(255) NOT NULL,
`nama_korespondensi` varchar(255) NOT NULL,
`alamat_perusahaan` varchar(500) NOT NULL,
`username` varchar(40) DEFAULT NULL,
`password` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `client`
--
INSERT INTO `client` (`client_id`, `nama_client`, `nama_korespondensi`, `alamat_perusahaan`, `username`, `password`) VALUES ('1', 'OWL', 'riki', '...', 'admin', 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `detail_maintenance`
--
CREATE TABLE `detail_maintenance` (
`detail_id` int(6) NOT NULL,
`transaksi_id` int(6) NOT NULL,
`produk_mt` varchar(255) DEFAULT NULL,
`no_sn` int(10) NOT NULL,
`garansi` binary(1) DEFAULT NULL,
`keterangan` varchar(255) NOT NULL,
`kedatangan` binary(1) NOT NULL,
`cek_barang` binary(1) NOT NULL,
`berita_as` binary(1) NOT NULL,
`administrasi` binary(1) NOT NULL,
`pengiriman` binary(1) NOT NULL,
`no_resi` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `firmware_setup`
--
CREATE TABLE `firmware_setup` (
`produk` varchar(20) NOT NULL,
`firmware` varchar(10) NOT NULL,
`hardware` varchar(10) NOT NULL,
`path` varchar(200) DEFAULT NULL,
`flag_active` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `historis`
--
CREATE TABLE `historis` (
`ID` int(6) NOT NULL,
`pengguna` varchar(40) NOT NULL,
`nama_barang` varchar(200) NOT NULL,
`waktu` datetime(6) NOT NULL,
`quantity` int(6) NOT NULL,
`activity` varchar(20) NOT NULL,
`deskripsi` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `inventaris_produk`
--
CREATE TABLE `inventaris_produk` (
`id` int(6) NOT NULL,
`type_produk` varchar(20) DEFAULT NULL,
`produk` varchar(40) DEFAULT NULL,
`chip_id` int(12) DEFAULT NULL,
`no_sn` int(10) DEFAULT NULL,
`nama_client` varchar(40) DEFAULT NULL,
`garansi_awal` date DEFAULT NULL,
`garansi_akhir` date DEFAULT NULL,
`garansi_void` tinyint(1) DEFAULT NULL,
`keterangan_void` varchar(40) DEFAULT NULL,
`ip_address` varchar(16) DEFAULT NULL,
`mac_wifi` varchar(20) DEFAULT NULL,
`mac_bluetooth` varchar(20) DEFAULT NULL,
`firmware_version` varchar(6) DEFAULT NULL,
`hardware_version` varchar(6) DEFAULT NULL,
`free_ram` int(6) DEFAULT NULL,
`min_ram` int(6) DEFAULT NULL,
`batt_low` int(4) DEFAULT NULL,
`batt_high` int(4) DEFAULT NULL,
`temperature` float DEFAULT NULL,
`status_error` int(4) DEFAULT NULL,
`gps_latitude` float DEFAULT NULL,
`gps_longitude` float DEFAULT NULL,
`status_qc_sensor_1` varchar(255) DEFAULT NULL,
`status_qc_sensor_2` varchar(255) DEFAULT NULL,
`status_qc_sensor_3` varchar(255) DEFAULT NULL,
`status_qc_sensor_4` varchar(255) DEFAULT NULL,
`status_qc_sensor_5` varchar(255) DEFAULT NULL,
`status_qc_sensor_6` varchar(255) DEFAULT NULL,
`last_online` datetime DEFAULT NULL,
`bat` int(5) DEFAULT NULL,
`pt` varchar(10) DEFAULT NULL,
`unit` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `masterbahan`
--
CREATE TABLE `masterbahan` (
`stok_id` int(6) UNSIGNED NOT NULL,
`kelompok` varchar(255) DEFAULT NULL,
`nama` varchar(255) NOT NULL,
`quantity` int(12) NOT NULL,
`harga_bahan` int(10) DEFAULT NULL,
`lokasi_penyimpanan` varchar(50) DEFAULT NULL,
`deskripsi` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `masterkelompok`
--
CREATE TABLE `masterkelompok` (
`kelompok_id` int(11) NOT NULL,
`nama_kelompok` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `produk`
--
CREATE TABLE `produk` (
`produk_id` int(6) NOT NULL,
`nama_produk` varchar(20) NOT NULL,
`quantity` int(6) NOT NULL,
`hpp_produk` int(10) DEFAULT NULL,
`gambar_produk` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `transaksi_maintenance`
--
CREATE TABLE `transaksi_maintenance` (
`transaksi_id` int(11) NOT NULL,
`tanggal_terima` date NOT NULL,
`nama_client` varchar(255) DEFAULT NULL,
`last_edit` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `user_account`
--
CREATE TABLE `user_account` (
`account_id` int(6) NOT NULL,
`nama_lengkap` varchar(100) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(100) NOT NULL,
`role` varchar(10) NOT NULL,
`tanda_tangan` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `user_account`
--
INSERT INTO `user_account` (`account_id`, `nama_lengkap`, `username`, `password`, `role`, `tanda_tangan`) VALUES ('1', 'admin', 'admin', 'admin', 'admin', NULL);
--
-- Indexes for table `bahan_produksi`
--
ALTER TABLE `bahan_produksi`
ADD PRIMARY KEY (`ID`),
ADD KEY `nama_bahan` (`nama_bahan`),
ADD KEY `produk` (`produk`);
--
-- Indexes for table `client`
--
ALTER TABLE `client`
ADD PRIMARY KEY (`client_id`),
ADD UNIQUE KEY `nama_client` (`nama_client`);
--
-- Indexes for table `detail_maintenance`
--
ALTER TABLE `detail_maintenance`
ADD PRIMARY KEY (`detail_id`),
ADD KEY `id_transaksi` (`transaksi_id`),
ADD KEY `produk_mt` (`produk_mt`),
ADD KEY `no_sn` (`no_sn`);
--
-- Indexes for table `historis`
--
ALTER TABLE `historis`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `inventaris_produk`
--
ALTER TABLE `inventaris_produk`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `no_sn` (`no_sn`),
ADD KEY `produk` (`produk`);
--
-- Indexes for table `masterbahan`
--
ALTER TABLE `masterbahan`
ADD PRIMARY KEY (`stok_id`),
ADD UNIQUE KEY `nama` (`nama`),
ADD KEY `kelompok` (`kelompok`);
--
-- Indexes for table `masterkelompok`
--
ALTER TABLE `masterkelompok`
ADD PRIMARY KEY (`kelompok_id`),
ADD UNIQUE KEY `nama_kelompok` (`nama_kelompok`),
ADD UNIQUE KEY `nama_kelompok_2` (`nama_kelompok`);
--
-- Indexes for table `produk`
--
ALTER TABLE `produk`
ADD PRIMARY KEY (`produk_id`),
ADD UNIQUE KEY `nama_produk` (`nama_produk`);
--
-- Indexes for table `transaksi_maintenance`
--
ALTER TABLE `transaksi_maintenance`
ADD PRIMARY KEY (`transaksi_id`),
ADD KEY `nama_client` (`nama_client`);
--
-- Indexes for table `user_account`
--
ALTER TABLE `user_account`
ADD PRIMARY KEY (`account_id`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `bahan_produksi`
--
ALTER TABLE `bahan_produksi`
MODIFY `ID` int(6) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `client`
--
ALTER TABLE `client`
MODIFY `client_id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `detail_maintenance`
--
ALTER TABLE `detail_maintenance`
MODIFY `detail_id` int(6) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `historis`
--
ALTER TABLE `historis`
MODIFY `ID` int(6) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `inventaris_produk`
--
ALTER TABLE `inventaris_produk`
MODIFY `id` int(6) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `masterbahan`
--
ALTER TABLE `masterbahan`
MODIFY `stok_id` int(6) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `masterkelompok`
--
ALTER TABLE `masterkelompok`
MODIFY `kelompok_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `produk`
--
ALTER TABLE `produk`
MODIFY `produk_id` int(6) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `transaksi_maintenance`
--
ALTER TABLE `transaksi_maintenance`
MODIFY `transaksi_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_account`
--
ALTER TABLE `user_account`
MODIFY `account_id` int(6) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bahan_produksi`
--
ALTER TABLE `bahan_produksi`
ADD CONSTRAINT `bahan_produksi_ibfk_1` FOREIGN KEY (`nama_bahan`) REFERENCES `masterbahan` (`nama`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bahan_produksi_ibfk_2` FOREIGN KEY (`produk`) REFERENCES `produk` (`nama_produk`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `detail_maintenance`
--
ALTER TABLE `detail_maintenance`
ADD CONSTRAINT `detail_maintenance_ibfk_1` FOREIGN KEY (`transaksi_id`) REFERENCES `transaksi_maintenance` (`transaksi_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `detail_maintenance_ibfk_2` FOREIGN KEY (`produk_mt`) REFERENCES `produk` (`nama_produk`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `detail_maintenance_ibfk_3` FOREIGN KEY (`no_sn`) REFERENCES `inventaris_produk` (`no_sn`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `inventaris_produk`
--
ALTER TABLE `inventaris_produk`
ADD CONSTRAINT `inventaris_produk_ibfk_2` FOREIGN KEY (`produk`) REFERENCES `produk` (`nama_produk`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `masterbahan`
--
ALTER TABLE `masterbahan`
ADD CONSTRAINT `masterbahan_ibfk_1` FOREIGN KEY (`kelompok`) REFERENCES `masterkelompok` (`nama_kelompok`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `transaksi_maintenance`
--
ALTER TABLE `transaksi_maintenance`
ADD CONSTRAINT `transaksi_maintenance_ibfk_1` FOREIGN KEY (`nama_client`) REFERENCES `client` (`nama_client`) 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 */;