text: -- phpMyAdmin SQL Dump
  -- version 5.1.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Nov 15, 2021 at 04:19 PM
  -- Server version: 10.4.20-MariaDB
  -- PHP Version: 7.3.29
  
  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: `omahjamur_db`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `admin`
  --
  
  CREATE TABLE `admin` (
    `id_admin` int(11) NOT NULL,
    `id_pengguna` int(11) NOT NULL,
    `foto` varchar(200) NOT NULL,
    `nama` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `admin`
  --
  
  INSERT INTO `admin` (`id_admin`, `id_pengguna`, `foto`, `nama`) VALUES
  (2, 2, 'default.jpg', 'Polo');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_jenis_produk`
  --
  
  CREATE TABLE `detail_jenis_produk` (
    `id_detail_jenis_produk` int(11) NOT NULL,
    `id_jenis_produk` int(11) NOT NULL,
    `deskripsi` varchar(100) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `detail_jenis_produk`
  --
  
  INSERT INTO `detail_jenis_produk` (`id_detail_jenis_produk`, `id_jenis_produk`, `deskripsi`) VALUES
  (1, 2, 'Jamur Tiram Putih'),
  (2, 1, 'Tiram Putih');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_transaksi`
  --
  
  CREATE TABLE `detail_transaksi` (
    `id_detail_transaksi` int(11) NOT NULL,
    `id_transaksi` int(11) NOT NULL,
    `id_produk` int(11) NOT NULL,
    `jumlah` int(11) NOT NULL,
    `sub_total` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `jenis_produk`
  --
  
  CREATE TABLE `jenis_produk` (
    `id_jenis_produk` int(11) NOT NULL,
    `deskripsi` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `jenis_produk`
  --
  
  INSERT INTO `jenis_produk` (`id_jenis_produk`, `deskripsi`) VALUES
  (1, 'Jamur'),
  (2, 'Bibit'),
  (3, 'Baglog');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `keranjang`
  --
  
  CREATE TABLE `keranjang` (
    `id_keranjang` int(11) NOT NULL,
    `id_pengguna` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pembayaran`
  --
  
  CREATE TABLE `pembayaran` (
    `id_pembayaran` int(11) NOT NULL,
    `id_transaksi` int(11) NOT NULL,
    `bukti` varchar(200) NOT NULL,
    `bank_pengirim` varchar(50) NOT NULL,
    `nama_akun_pengirim` varchar(100) NOT NULL,
    `status` int(11) NOT NULL,
    `tanggal` date NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pengguna`
  --
  
  CREATE TABLE `pengguna` (
    `id_pengguna` int(11) NOT NULL,
    `id_role` int(11) NOT NULL,
    `email` varchar(100) NOT NULL,
    `password` varchar(20) NOT NULL,
    `tanggal_dibuat` datetime NOT NULL,
    `status` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `pengguna`
  --
  
  INSERT INTO `pengguna` (`id_pengguna`, `id_role`, `email`, `password`, `tanggal_dibuat`, `status`) VALUES
  (1, 3, 'bla@email.com', '', '2021-10-11 01:00:00', 1),
  (2, 1, 'admin@email.com', 'admin', '2021-10-11 00:00:00', 1),
  (3, 2, 'a@email.com', '12345', '2021-10-12 15:22:11', 1),
  (4, 2, 'b@email.com', '', '2021-10-12 20:23:38', 1),
  (19, 2, 'hendrapolover@gmail.com', '', '2021-10-21 22:59:28', 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `petani`
  --
  
  CREATE TABLE `petani` (
    `id_petani` int(11) NOT NULL,
    `id_pengguna` int(11) NOT NULL,
    `nama` varchar(100) NOT NULL,
    `alamat` varchar(100) NOT NULL,
    `foto` varchar(200) NOT NULL,
    `latitude` varchar(100) NOT NULL,
    `longitude` varchar(100) NOT NULL,
    `status` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `petani`
  --
  
  INSERT INTO `petani` (`id_petani`, `id_pengguna`, `nama`, `alamat`, `foto`, `latitude`, `longitude`, `status`) VALUES
  (1, 4, 'Hendra', 'Candi', 'default.jpg', '232323', '232323', 1),
  (2, 3, 'Polo', 'Candi', 'default.jpg', '232323', '232323', 0),
  (8, 19, 'xdr', 'dm', 'SAVE_20211011_173536.jpg', '0', '0', 0);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `produk`
  --
  
  CREATE TABLE `produk` (
    `id_produk` int(11) NOT NULL,
    `id_petani` int(11) NOT NULL,
    `id_detail_jenis_produk` int(11) NOT NULL,
    `judul` varchar(50) NOT NULL,
    `deskripsi` text NOT NULL,
    `harga` int(11) NOT NULL,
    `stok` int(11) NOT NULL,
    `gambar` varchar(200) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `produk`
  --
  
  INSERT INTO `produk` (`id_produk`, `id_petani`, `id_detail_jenis_produk`, `judul`, `deskripsi`, `harga`, `stok`, `gambar`) VALUES
  (1, 8, 1, 'uyue', '37ır', 645, 555, 'IMG_20211114_093719.jpg');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `role`
  --
  
  CREATE TABLE `role` (
    `id_role` int(11) NOT NULL,
    `deskripsi` varchar(20) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `role`
  --
  
  INSERT INTO `role` (`id_role`, `deskripsi`) VALUES
  (1, 'admin'),
  (2, 'petani'),
  (3, 'customer');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `transaksi`
  --
  
  CREATE TABLE `transaksi` (
    `id_transaksi` int(11) NOT NULL,
    `total` int(11) NOT NULL,
    `status` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `admin`
  --
  ALTER TABLE `admin`
    ADD PRIMARY KEY (`id_admin`),
    ADD KEY `fk_pends` (`id_pengguna`);
  
  --
  -- Indexes for table `detail_jenis_produk`
  --
  ALTER TABLE `detail_jenis_produk`
    ADD PRIMARY KEY (`id_detail_jenis_produk`),
    ADD KEY `fk_detail_jenis_p` (`id_jenis_produk`);
  
  --
  -- Indexes for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    ADD PRIMARY KEY (`id_detail_transaksi`),
    ADD KEY `fk_id_trans` (`id_transaksi`),
    ADD KEY `fk_id_pro` (`id_produk`);
  
  --
  -- Indexes for table `jenis_produk`
  --
  ALTER TABLE `jenis_produk`
    ADD PRIMARY KEY (`id_jenis_produk`);
  
  --
  -- Indexes for table `keranjang`
  --
  ALTER TABLE `keranjang`
    ADD PRIMARY KEY (`id_keranjang`);
  
  --
  -- Indexes for table `pembayaran`
  --
  ALTER TABLE `pembayaran`
    ADD PRIMARY KEY (`id_pembayaran`),
    ADD KEY `fk_id_pem_tr` (`id_transaksi`);
  
  --
  -- Indexes for table `pengguna`
  --
  ALTER TABLE `pengguna`
    ADD PRIMARY KEY (`id_pengguna`),
    ADD KEY `fk_id_rol` (`id_role`);
  
  --
  -- Indexes for table `petani`
  --
  ALTER TABLE `petani`
    ADD PRIMARY KEY (`id_petani`),
    ADD KEY `fk_pe_id_p` (`id_pengguna`);
  
  --
  -- Indexes for table `produk`
  --
  ALTER TABLE `produk`
    ADD PRIMARY KEY (`id_produk`),
    ADD KEY `fk_id_pean_d` (`id_petani`),
    ADD KEY `fk_jn_pro` (`id_detail_jenis_produk`);
  
  --
  -- Indexes for table `role`
  --
  ALTER TABLE `role`
    ADD PRIMARY KEY (`id_role`);
  
  --
  -- Indexes for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD PRIMARY KEY (`id_transaksi`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `admin`
  --
  ALTER TABLE `admin`
    MODIFY `id_admin` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `detail_jenis_produk`
  --
  ALTER TABLE `detail_jenis_produk`
    MODIFY `id_detail_jenis_produk` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    MODIFY `id_detail_transaksi` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `jenis_produk`
  --
  ALTER TABLE `jenis_produk`
    MODIFY `id_jenis_produk` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `keranjang`
  --
  ALTER TABLE `keranjang`
    MODIFY `id_keranjang` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `pembayaran`
  --
  ALTER TABLE `pembayaran`
    MODIFY `id_pembayaran` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `pengguna`
  --
  ALTER TABLE `pengguna`
    MODIFY `id_pengguna` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
  
  --
  -- AUTO_INCREMENT for table `petani`
  --
  ALTER TABLE `petani`
    MODIFY `id_petani` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
  
  --
  -- AUTO_INCREMENT for table `produk`
  --
  ALTER TABLE `produk`
    MODIFY `id_produk` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `role`
  --
  ALTER TABLE `role`
    MODIFY `id_role` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `transaksi`
  --
  ALTER TABLE `transaksi`
    MODIFY `id_transaksi` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `admin`
  --
  ALTER TABLE `admin`
    ADD CONSTRAINT `fk_pends` FOREIGN KEY (`id_pengguna`) REFERENCES `pengguna` (`id_pengguna`);
  
  --
  -- Constraints for table `detail_jenis_produk`
  --
  ALTER TABLE `detail_jenis_produk`
    ADD CONSTRAINT `fk_detail_jenis_p` FOREIGN KEY (`id_jenis_produk`) REFERENCES `jenis_produk` (`id_jenis_produk`);
  
  --
  -- Constraints for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    ADD CONSTRAINT `fk_id_pro` FOREIGN KEY (`id_produk`) REFERENCES `produk` (`id_produk`),
    ADD CONSTRAINT `fk_id_trans` FOREIGN KEY (`id_transaksi`) REFERENCES `transaksi` (`id_transaksi`);
  
  --
  -- Constraints for table `pembayaran`
  --
  ALTER TABLE `pembayaran`
    ADD CONSTRAINT `fk_id_pem_tr` FOREIGN KEY (`id_transaksi`) REFERENCES `transaksi` (`id_transaksi`);
  
  --
  -- Constraints for table `pengguna`
  --
  ALTER TABLE `pengguna`
    ADD CONSTRAINT `fk_id_rol` FOREIGN KEY (`id_role`) REFERENCES `role` (`id_role`);
  
  --
  -- Constraints for table `petani`
  --
  ALTER TABLE `petani`
    ADD CONSTRAINT `fk_pe_id_p` FOREIGN KEY (`id_pengguna`) REFERENCES `pengguna` (`id_pengguna`);
  
  --
  -- Constraints for table `produk`
  --
  ALTER TABLE `produk`
    ADD CONSTRAINT `fk_id_pean_d` FOREIGN KEY (`id_petani`) REFERENCES `petani` (`id_petani`),
    ADD CONSTRAINT `fk_jn_pro` FOREIGN KEY (`id_detail_jenis_produk`) REFERENCES `detail_jenis_produk` (`id_detail_jenis_produk`);
  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 */;
  