text: -- phpMyAdmin SQL Dump
  -- version 4.9.0.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Sep 15, 2019 at 06:20 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: `ruang`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `admin`
  --
  
  CREATE TABLE `admin` (
    `id_admin` int(255) NOT NULL,
    `username` varchar(255) NOT NULL,
    `password` varchar(255) NOT NULL,
    `create_at` datetime NOT NULL DEFAULT current_timestamp(),
    `update_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `admin`
  --
  
  INSERT INTO `admin` (`id_admin`, `username`, `password`, `create_at`, `update_at`) VALUES
  (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '2019-09-14 18:00:48', '2019-09-14 18:00:48');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `gedung`
  --
  
  CREATE TABLE `gedung` (
    `id_gedung` int(10) NOT NULL,
    `nama_gedung` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `gedung`
  --
  
  INSERT INTO `gedung` (`id_gedung`, `nama_gedung`) VALUES
  (1, 'Dewi Sartika'),
  (2, 'Ki Hajar Dewantara');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `kelas`
  --
  
  CREATE TABLE `kelas` (
    `id_kelas` int(10) NOT NULL,
    `id_ruang` int(10) NOT NULL,
    `hari` date NOT NULL,
    `jam_awal` time NOT NULL,
    `jam_akhir` time NOT NULL,
    `matkul` varchar(255) NOT NULL,
    `pengajar` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pinjam`
  --
  
  CREATE TABLE `pinjam` (
    `id_pinjam` int(10) NOT NULL,
    `id_user` int(10) NOT NULL,
    `id_ruang` int(10) NOT NULL,
    `tanggal_pinjam` date NOT NULL,
    `jam_awal` time NOT NULL,
    `jam_akhir` time NOT NULL,
    `alasan` varchar(255) NOT NULL,
    `KTM` varchar(255) NOT NULL,
    `status` varchar(255) NOT NULL,
    `create_at` timestamp NOT NULL DEFAULT current_timestamp()
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `ruang`
  --
  
  CREATE TABLE `ruang` (
    `id_ruang` int(10) NOT NULL,
    `nama_ruang` varchar(255) NOT NULL,
    `id_gedung` int(10) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user`
  --
  
  CREATE TABLE `user` (
    `id_user` int(255) NOT NULL,
    `NIM` int(11) NOT NULL,
    `nama` varchar(255) NOT NULL,
    `password` varchar(8) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `user`
  --
  
  INSERT INTO `user` (`id_user`, `NIM`, `nama`, `password`) VALUES
  (1, 1710511064, 'Kartika Ananda Putri', '123456');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `admin`
  --
  ALTER TABLE `admin`
    ADD PRIMARY KEY (`id_admin`);
  
  --
  -- Indexes for table `gedung`
  --
  ALTER TABLE `gedung`
    ADD PRIMARY KEY (`id_gedung`);
  
  --
  -- Indexes for table `kelas`
  --
  ALTER TABLE `kelas`
    ADD PRIMARY KEY (`id_kelas`),
    ADD KEY `id_ruang` (`id_ruang`);
  
  --
  -- Indexes for table `pinjam`
  --
  ALTER TABLE `pinjam`
    ADD PRIMARY KEY (`id_pinjam`),
    ADD KEY `id_user` (`id_user`),
    ADD KEY `id_ruang` (`id_ruang`);
  
  --
  -- Indexes for table `ruang`
  --
  ALTER TABLE `ruang`
    ADD PRIMARY KEY (`id_ruang`),
    ADD KEY `id_gedung` (`id_gedung`);
  
  --
  -- Indexes for table `user`
  --
  ALTER TABLE `user`
    ADD PRIMARY KEY (`id_user`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `admin`
  --
  ALTER TABLE `admin`
    MODIFY `id_admin` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `gedung`
  --
  ALTER TABLE `gedung`
    MODIFY `id_gedung` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `kelas`
  --
  ALTER TABLE `kelas`
    MODIFY `id_kelas` int(10) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `pinjam`
  --
  ALTER TABLE `pinjam`
    MODIFY `id_pinjam` int(10) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `ruang`
  --
  ALTER TABLE `ruang`
    MODIFY `id_ruang` int(10) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `user`
  --
  ALTER TABLE `user`
    MODIFY `id_user` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `kelas`
  --
  ALTER TABLE `kelas`
    ADD CONSTRAINT `kelas_ibfk_1` FOREIGN KEY (`id_ruang`) REFERENCES `ruang` (`id_ruang`);
  
  --
  -- Constraints for table `pinjam`
  --
  ALTER TABLE `pinjam`
    ADD CONSTRAINT `pinjam_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`),
    ADD CONSTRAINT `pinjam_ibfk_2` FOREIGN KEY (`id_ruang`) REFERENCES `ruang` (`id_ruang`);
  
  --
  -- Constraints for table `ruang`
  --
  ALTER TABLE `ruang`
    ADD CONSTRAINT `ruang_ibfk_1` FOREIGN KEY (`id_gedung`) REFERENCES `gedung` (`id_gedung`);
  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 */;
  