/*

SQLyog Ultimate v8.55 
MySQL - 5.5.5-10.1.13-MariaDB : Database - proyekpsw4

*********************************************************************

*/



/*!40101 SET NAMES utf8 */;



/*!40101 SET SQL_MODE=''*/;



/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;

/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;

/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

CREATE DATABASE /*!32312 IF NOT EXISTS*/`proyekpsw4` /*!40100 DEFAULT CHARACTER SET latin1 */;



USE `proyekpsw4`;



/*Table structure for table `jawaban` */



DROP TABLE IF EXISTS `jawaban`;



CREATE TABLE `jawaban` (
  `id_jawaban` int(11) NOT NULL AUTO_INCREMENT,
  `id_keluhan` int(11) NOT NULL,
  `tanggal_jawaban` varchar(100) NOT NULL,
  `jawaban` text NOT NULL,
  PRIMARY KEY (`id_jawaban`),
  UNIQUE KEY `id_keluhan` (`id_keluhan`),
  CONSTRAINT `jawaban_ibfk_1` FOREIGN KEY (`id_keluhan`) REFERENCES `keluhan` (`id_keluhan`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;



/*Data for the table `jawaban` */



insert  into `jawaban`(`id_jawaban`,`id_keluhan`,`tanggal_jawaban`,`jawaban`) values (14,41,'Saturday, 06-06-2020 08:26:39:am','adadsad'),(15,43,'Saturday, 06-06-2020 02:45:35:pm','re');



/*Table structure for table `jeniskeluhan` */



DROP TABLE IF EXISTS `jeniskeluhan`;



CREATE TABLE `jeniskeluhan` (
  `id_jenis` int(11) NOT NULL AUTO_INCREMENT,
  `jenis` varchar(100) NOT NULL,
  PRIMARY KEY (`id_jenis`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;



/*Data for the table `jeniskeluhan` */



insert  into `jeniskeluhan`(`id_jenis`,`jenis`) values (1,'Bantuan Masyarakat'),(2,'Insfrastruktur tidak baik'),(3,'Layanan Kesehatan'),(4,'Pemungutan Liar'),(5,'Petugas tidak ramah'),(6,'Tindakan KKN');



/*Table structure for table `keluhan` */



DROP TABLE IF EXISTS `keluhan`;



CREATE TABLE `keluhan` (
  `id_keluhan` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `id_jenis` int(11) NOT NULL,
  `subjek` varchar(100) NOT NULL,
  `keluhan` text NOT NULL,
  `tanggal` varchar(100) NOT NULL,
  `gambar1` varchar(100) NOT NULL,
  `gambar2` varchar(100) NOT NULL,
  `status` enum('sudah','belum') NOT NULL,
  PRIMARY KEY (`id_keluhan`),
  KEY `id_user` (`id_user`),
  KEY `id_jenis` (`id_jenis`),
  CONSTRAINT `keluhan_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `keluhan_ibfk_2` FOREIGN KEY (`id_jenis`) REFERENCES `jeniskeluhan` (`id_jenis`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=latin1;



/*Data for the table `keluhan` */



insert  into `keluhan`(`id_keluhan`,`id_user`,`id_jenis`,`subjek`,`keluhan`,`tanggal`,`gambar1`,`gambar2`,`status`) values (41,2,2,'qwe','qwe','Saturday, 06-06-2020 08:26:16:am','1','1','sudah'),(42,2,1,'asd','asd','Saturday, 06-06-2020 11:55:13:am','1','1',''),(43,2,2,'asd','asd','Saturday, 06-06-2020 11:55:19:am','1','1','sudah'),(44,2,6,'asd','asd','Saturday, 06-06-2020 11:57:31:am','1','1',''),(48,2,2,'asd ',' asd sad ','Saturday, 06-06-2020 02:44:57:pm','1','1',''),(49,2,3,'as d','as das das da s','Saturday, 06-06-2020 02:45:12:pm','1','1','');



/*Table structure for table `kontak` */



DROP TABLE IF EXISTS `kontak`;



CREATE TABLE `kontak` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nama` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `subjek` varchar(100) NOT NULL,
  `pesan` text NOT NULL,
  `tanggal` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;



/*Data for the table `kontak` */



insert  into `kontak`(`id`,`nama`,`email`,`subjek`,`pesan`,`tanggal`) values (3,'asd','123@gmail.com','asd','asd','Saturday, 06-06-2020 08:18:39:am'),(4,'asd','123@gmail.com','asd','sad','Saturday, 06-06-2020 01:29:53:pm'),(5,'ggg','123@gmail.com','asd','asd','Saturday, 06-06-2020 01:43:59:pm');



/*Table structure for table `user` */



DROP TABLE IF EXISTS `user`;



CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `gambar` varchar(100) NOT NULL,
  `nama` varchar(100) NOT NULL,
  `alamat` varchar(100) NOT NULL,
  `nim` varchar(100) NOT NULL,
  `TTL` varchar(100) NOT NULL,
  `jenis` varchar(100) NOT NULL,
  `telepon` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `pekerjaan` varchar(100) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `level` enum('admin','user') NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;



/*Data for the table `user` */



insert  into `user`(`id`,`gambar`,`nama`,`alamat`,`nim`,`TTL`,`jenis`,`telepon`,`email`,`pekerjaan`,`username`,`password`,`level`) values (1,'ADMIN','ADMIN','ADMIN','ADMIN','ADMIN','ADMIN','ADMIN','ADMIN','ADMIN','admin','$2y$10$3OmOyQ6i9F3YiRm628RSpeHI468Tx4rapAfHVgTrCXVVy04tMd0Ci','admin'),(2,'5ec396095292c.png','USER1','USER2','USER3','USER4','USER5','USER6','USER7','USER8','user','$2y$10$j2lnpIrKwB0/KSH64zASs.X4ruaEfSMblR.PDRm35qeThiNq8xf9C','user');



/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;

/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

