text: -- phpMyAdmin SQL Dump
  -- version 4.9.0.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Jul 14, 2021 at 08:52 AM
  -- Server version: 10.4.6-MariaDB
  -- PHP Version: 7.3.9
  
  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: `db_perpustakaan`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `buku`
  --
  
  CREATE TABLE `buku` (
    `id` int(11) NOT NULL,
    `nama_buku` varchar(100) NOT NULL,
    `pengarang` varchar(100) NOT NULL,
    `deskripsi` text NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `buku`
  --
  
  INSERT INTO `buku` (`id`, `nama_buku`, `pengarang`, `deskripsi`) VALUES
  (1, 'xxx', 'xxx', 'xxx');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_peminjaman_buku`
  --
  
  CREATE TABLE `detail_peminjaman_buku` (
    `id` int(11) NOT NULL,
    `id_peminjaman_buku` int(11) NOT NULL,
    `id_buku` int(11) NOT NULL,
    `qty` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `detail_peminjaman_buku`
  --
  
  INSERT INTO `detail_peminjaman_buku` (`id`, `id_peminjaman_buku`, `id_buku`, `qty`) VALUES
  (1, 1, 1, 3);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `kelas`
  --
  
  CREATE TABLE `kelas` (
    `id` int(11) NOT NULL,
    `nama_kelas` varchar(20) NOT NULL,
    `kelompok` varchar(20) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `kelas`
  --
  
  INSERT INTO `kelas` (`id`, `nama_kelas`, `kelompok`) VALUES
  (1, 'x', 'rpl1');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `migrations`
  --
  
  CREATE TABLE `migrations` (
    `id` int(10) UNSIGNED NOT NULL,
    `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `batch` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `peminjaman_buku`
  --
  
  CREATE TABLE `peminjaman_buku` (
    `id` int(11) NOT NULL,
    `id_siswa` int(11) NOT NULL,
    `tanggal_pinjam` date NOT NULL,
    `tanggal_kembali` date NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `peminjaman_buku`
  --
  
  INSERT INTO `peminjaman_buku` (`id`, `id_siswa`, `tanggal_pinjam`, `tanggal_kembali`) VALUES
  (1, 2, '2021-07-10', '2021-07-10');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pengembalian_buku`
  --
  
  CREATE TABLE `pengembalian_buku` (
    `id` int(11) NOT NULL,
    `id_peminjaman_buku` int(11) NOT NULL,
    `tanggal_pengembalian` date NOT NULL,
    `denda` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `pengembalian_buku`
  --
  
  INSERT INTO `pengembalian_buku` (`id`, `id_peminjaman_buku`, `tanggal_pengembalian`, `denda`) VALUES
  (1, 1, '2021-07-14', 6000);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `siswa`
  --
  
  CREATE TABLE `siswa` (
    `id` int(11) NOT NULL,
    `nama_siswa` varchar(100) NOT NULL,
    `tanggal_lahir` date NOT NULL,
    `gender` enum('L','P') NOT NULL,
    `alamat` text NOT NULL,
    `id_kelas` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `siswa`
  --
  
  INSERT INTO `siswa` (`id`, `nama_siswa`, `tanggal_lahir`, `gender`, `alamat`, `id_kelas`) VALUES
  (2, 'budi gunawan', '2000-01-09', 'L', 'Kediri', 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `users`
  --
  
  CREATE TABLE `users` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Dumping data for table `users`
  --
  
  INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
  (6, 'sugeng dermawan', 'sugeng@gmail.com', '$2y$10$I/2b3EoOwlXZf.BygVbpAerOILsspjyfpwYZz0VXC5wK8hFOfy3cS', NULL, '2021-07-13 19:59:02', '2021-07-13 19:59:02');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `buku`
  --
  ALTER TABLE `buku`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `detail_peminjaman_buku`
  --
  ALTER TABLE `detail_peminjaman_buku`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `id_peminjaman_buku` (`id_peminjaman_buku`),
    ADD UNIQUE KEY `id_buku` (`id_buku`);
  
  --
  -- Indexes for table `kelas`
  --
  ALTER TABLE `kelas`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `migrations`
  --
  ALTER TABLE `migrations`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `peminjaman_buku`
  --
  ALTER TABLE `peminjaman_buku`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `id_siswa` (`id_siswa`);
  
  --
  -- Indexes for table `pengembalian_buku`
  --
  ALTER TABLE `pengembalian_buku`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `id_peminjaman_buku` (`id_peminjaman_buku`);
  
  --
  -- Indexes for table `siswa`
  --
  ALTER TABLE `siswa`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `id_kelas` (`id_kelas`);
  
  --
  -- Indexes for table `users`
  --
  ALTER TABLE `users`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `users_email_unique` (`email`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `buku`
  --
  ALTER TABLE `buku`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `detail_peminjaman_buku`
  --
  ALTER TABLE `detail_peminjaman_buku`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `kelas`
  --
  ALTER TABLE `kelas`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `migrations`
  --
  ALTER TABLE `migrations`
    MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `peminjaman_buku`
  --
  ALTER TABLE `peminjaman_buku`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `pengembalian_buku`
  --
  ALTER TABLE `pengembalian_buku`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `siswa`
  --
  ALTER TABLE `siswa`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `users`
  --
  ALTER TABLE `users`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `detail_peminjaman_buku`
  --
  ALTER TABLE `detail_peminjaman_buku`
    ADD CONSTRAINT `detail_peminjaman_buku_ibfk_1` FOREIGN KEY (`id_peminjaman_buku`) REFERENCES `peminjaman_buku` (`id`),
    ADD CONSTRAINT `detail_peminjaman_buku_ibfk_2` FOREIGN KEY (`id_buku`) REFERENCES `buku` (`id`);
  
  --
  -- Constraints for table `peminjaman_buku`
  --
  ALTER TABLE `peminjaman_buku`
    ADD CONSTRAINT `peminjaman_buku_ibfk_1` FOREIGN KEY (`id_siswa`) REFERENCES `siswa` (`id`);
  
  --
  -- Constraints for table `pengembalian_buku`
  --
  ALTER TABLE `pengembalian_buku`
    ADD CONSTRAINT `pengembalian_buku_ibfk_1` FOREIGN KEY (`id_peminjaman_buku`) REFERENCES `peminjaman_buku` (`id`);
  
  --
  -- Constraints for table `siswa`
  --
  ALTER TABLE `siswa`
    ADD CONSTRAINT `siswa_ibfk_1` FOREIGN KEY (`id_kelas`) REFERENCES `kelas` (`id`);
  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 */;
  