text: -- phpMyAdmin SQL Dump
  -- version 4.8.4
  -- https://www.phpmyadmin.net/
  --
  -- Host: localhost
  -- Generation Time: Apr 15, 2019 at 01:54 PM
  -- Server version: 10.1.37-MariaDB
  -- PHP Version: 7.3.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: `apps_inventori`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_pinjam`
  --
  
  CREATE TABLE `detail_pinjam` (
    `id_detail_pinjam` int(10) UNSIGNED NOT NULL,
    `id_peminjaman` int(10) UNSIGNED NOT NULL,
    `id_inventaris` int(10) UNSIGNED NOT NULL,
    `jumlah` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `inventaris`
  --
  
  CREATE TABLE `inventaris` (
    `id_inventaris` int(10) UNSIGNED NOT NULL,
    `id_petugas` int(10) UNSIGNED NOT NULL,
    `id_jenis` int(10) UNSIGNED NOT NULL,
    `id_ruang` int(10) UNSIGNED NOT NULL,
    `nama` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `kondisi` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `keterangan` text COLLATE utf8mb4_unicode_ci,
    `jumlah` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `kode_inventaris` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `tanggal_register` datetime NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `inventaris`
  --
  
  INSERT INTO `inventaris` (`id_inventaris`, `id_petugas`, `id_jenis`, `id_ruang`, `nama`, `kondisi`, `keterangan`, `jumlah`, `kode_inventaris`, `tanggal_register`) VALUES
  (4, 3, 1, 1, 'Komputer', 'Sangat Baik', 'Pakai Komputer Sewajarnya', '35', '5CE6B', '2019-04-04 21:16:00'),
  (5, 3, 2, 2, 'Laptop', 'Buruk', 'Gausah Ngelawan', '3', '620B4', '2019-04-04 21:15:08'),
  (9, 2, 1, 1, 'Mouse Gaming', 'Baik', 'Permainan', '2', '6bf51', '2019-04-08 07:47:39');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `jenis`
  --
  
  CREATE TABLE `jenis` (
    `id_jenis` int(10) UNSIGNED NOT NULL,
    `nama_jenis` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `kode_jenis` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `keterangan` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `jenis`
  --
  
  INSERT INTO `jenis` (`id_jenis`, `nama_jenis`, `kode_jenis`, `keterangan`) VALUES
  (1, 'Elektronik', '891273', ''),
  (2, 'Fasilitas', '1234123', '');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `level`
  --
  
  CREATE TABLE `level` (
    `id_level` int(10) UNSIGNED NOT NULL,
    `nama_level` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `level`
  --
  
  INSERT INTO `level` (`id_level`, `nama_level`) VALUES
  (1, 'Admin'),
  (2, 'Operator'),
  (3, 'Peminjam');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `migrations`
  --
  
  CREATE TABLE `migrations` (
    `id` int(10) UNSIGNED NOT NULL,
    `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `batch` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `migrations`
  --
  
  INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
  (1, '2019_03_18_180412_create_petugas_tables', 1),
  (2, '2019_03_18_180420_create_level_tables', 1),
  (3, '2019_03_19_035326_create_jenis_tables', 1),
  (4, '2019_03_19_043009_create_ruang_tables', 1),
  (5, '2019_03_19_043029_create_pegawai_tables', 1),
  (6, '2019_03_19_043052_create_peminjaman_tables', 1),
  (7, '2019_03_19_043106_create_detail_pinjam_tables', 1),
  (8, '2019_03_19_043118_create_inventaris_tables', 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pegawai`
  --
  
  CREATE TABLE `pegawai` (
    `id_pegawai` int(10) UNSIGNED NOT NULL,
    `nama_pegawai` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `nip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `alamat` text COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `pegawai`
  --
  
  INSERT INTO `pegawai` (`id_pegawai`, `nama_pegawai`, `nip`, `alamat`) VALUES
  (5, 'Aditya Raihan', '101616300', 'Margahayu Raya'),
  (6, 'Eriansyah', '101616318', 'Cisaranten'),
  (8, 'Ramdhan Eka Saputra', '101616356', 'Ujungberung'),
  (9, 'Rama Reza Pramudya', '101616345', 'Griya Winaya');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `peminjaman`
  --
  
  CREATE TABLE `peminjaman` (
    `id_peminjaman` int(10) UNSIGNED NOT NULL,
    `id_pegawai` int(10) UNSIGNED NOT NULL,
    `tanggal_pinjam` datetime NOT NULL,
    `tanggal_kembali` datetime NOT NULL,
    `status_peminjaman` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `peminjaman`
  --
  
  INSERT INTO `peminjaman` (`id_peminjaman`, `id_pegawai`, `tanggal_pinjam`, `tanggal_kembali`, `status_peminjaman`) VALUES
  (1, 9, '2019-04-14 00:08:13', '2019-04-15 23:59:00', 'Meminjam');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `petugas`
  --
  
  CREATE TABLE `petugas` (
    `id_petugas` int(10) UNSIGNED NOT NULL,
    `id_level` int(10) UNSIGNED NOT NULL,
    `nama_petugas` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `petugas`
  --
  
  INSERT INTO `petugas` (`id_petugas`, `id_level`, `nama_petugas`, `username`, `password`) VALUES
  (2, 1, 'Raka Sanjaya', 'sraka1790', '$2y$10$9W0h6apBSImfje447pEoYOMyCucYKABaXiYFb643gIZ6PdYSML5lK'),
  (3, 3, 'Ramdhan Eka Saputra', 'ramdhaneka90', '$2y$10$/cLBxUMiTGhv4hMEDK7irO8mKkeCJt1/OUYEQ23CKKZreSGIU8kYu'),
  (5, 2, 'Fajar Aprianto', 'wokeh10', '$2y$10$DbSZCvb7fImfJQbyTm8j2OwNXrEm5TsWUSvdY5YG11H.chCQEl9Fe');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `ruang`
  --
  
  CREATE TABLE `ruang` (
    `id_ruang` int(10) UNSIGNED NOT NULL,
    `nama_ruang` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `kode_ruang` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `keterangan` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `ruang`
  --
  
  INSERT INTO `ruang` (`id_ruang`, `nama_ruang`, `kode_ruang`, `keterangan`) VALUES
  (1, 'R. 34', 'r34', ''),
  (2, 'R. 42', 'r32', '');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `detail_pinjam`
  --
  ALTER TABLE `detail_pinjam`
    ADD PRIMARY KEY (`id_detail_pinjam`),
    ADD KEY `detail_pinjam_id_peminjaman_foreign` (`id_peminjaman`),
    ADD KEY `detail_pinjam_id_inventaris_foreign` (`id_inventaris`);
  
  --
  -- Indexes for table `inventaris`
  --
  ALTER TABLE `inventaris`
    ADD PRIMARY KEY (`id_inventaris`),
    ADD KEY `inventaris_id_petugas_foreign` (`id_petugas`),
    ADD KEY `inventaris_id_jenis_foreign` (`id_jenis`),
    ADD KEY `inventaris_id_ruang_foreign` (`id_ruang`);
  
  --
  -- Indexes for table `jenis`
  --
  ALTER TABLE `jenis`
    ADD PRIMARY KEY (`id_jenis`);
  
  --
  -- Indexes for table `level`
  --
  ALTER TABLE `level`
    ADD PRIMARY KEY (`id_level`);
  
  --
  -- Indexes for table `migrations`
  --
  ALTER TABLE `migrations`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `pegawai`
  --
  ALTER TABLE `pegawai`
    ADD PRIMARY KEY (`id_pegawai`);
  
  --
  -- Indexes for table `peminjaman`
  --
  ALTER TABLE `peminjaman`
    ADD PRIMARY KEY (`id_peminjaman`),
    ADD KEY `peminjaman_id_pegawai_foreign` (`id_pegawai`);
  
  --
  -- Indexes for table `petugas`
  --
  ALTER TABLE `petugas`
    ADD PRIMARY KEY (`id_petugas`),
    ADD UNIQUE KEY `petugas_username_unique` (`username`),
    ADD KEY `petugas_id_level_foreign` (`id_level`);
  
  --
  -- Indexes for table `ruang`
  --
  ALTER TABLE `ruang`
    ADD PRIMARY KEY (`id_ruang`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `detail_pinjam`
  --
  ALTER TABLE `detail_pinjam`
    MODIFY `id_detail_pinjam` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `inventaris`
  --
  ALTER TABLE `inventaris`
    MODIFY `id_inventaris` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
  
  --
  -- AUTO_INCREMENT for table `jenis`
  --
  ALTER TABLE `jenis`
    MODIFY `id_jenis` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `level`
  --
  ALTER TABLE `level`
    MODIFY `id_level` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `migrations`
  --
  ALTER TABLE `migrations`
    MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
  
  --
  -- AUTO_INCREMENT for table `pegawai`
  --
  ALTER TABLE `pegawai`
    MODIFY `id_pegawai` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
  
  --
  -- AUTO_INCREMENT for table `peminjaman`
  --
  ALTER TABLE `peminjaman`
    MODIFY `id_peminjaman` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `petugas`
  --
  ALTER TABLE `petugas`
    MODIFY `id_petugas` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
  
  --
  -- AUTO_INCREMENT for table `ruang`
  --
  ALTER TABLE `ruang`
    MODIFY `id_ruang` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `detail_pinjam`
  --
  ALTER TABLE `detail_pinjam`
    ADD CONSTRAINT `detail_pinjam_id_inventaris_foreign` FOREIGN KEY (`id_inventaris`) REFERENCES `inventaris` (`id_inventaris`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `detail_pinjam_id_peminjaman_foreign` FOREIGN KEY (`id_peminjaman`) REFERENCES `peminjaman` (`id_peminjaman`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `inventaris`
  --
  ALTER TABLE `inventaris`
    ADD CONSTRAINT `inventaris_id_jenis_foreign` FOREIGN KEY (`id_jenis`) REFERENCES `jenis` (`id_jenis`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `inventaris_id_petugas_foreign` FOREIGN KEY (`id_petugas`) REFERENCES `petugas` (`id_petugas`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `inventaris_id_ruang_foreign` FOREIGN KEY (`id_ruang`) REFERENCES `ruang` (`id_ruang`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `peminjaman`
  --
  ALTER TABLE `peminjaman`
    ADD CONSTRAINT `peminjaman_id_pegawai_foreign` FOREIGN KEY (`id_pegawai`) REFERENCES `pegawai` (`id_pegawai`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `petugas`
  --
  ALTER TABLE `petugas`
    ADD CONSTRAINT `petugas_id_level_foreign` FOREIGN KEY (`id_level`) REFERENCES `level` (`id_level`) 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 */;
  