-- --------------------------------------------------------
-- Server OS:                    Win32
-- HeidiSQL Version:             9.4.0.5125
-- --------------------------------------------------------



-- Dumping database structure for pdam_web
CREATE DATABASE IF NOT EXISTS `pdam_web` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `pdam_web`;

-- Dumping structure for table pdam_web.permissions
CREATE TABLE IF NOT EXISTS `permissions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `display_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `built_in` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table pdam_web.permissions: ~17 rows (approximately)
DELETE FROM `permissions`;
INSERT INTO `permissions` (`id`, `name`, `display_name`, `description`, `built_in`, `created_at`, `updated_at`) VALUES
	(1, 'create-role', 'Create Role', 'Create Role', 1, '2018-06-06 10:24:35', '2018-06-06 10:24:35'),
	(2, 'read-role', 'Read Role', 'Read Role', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(3, 'update-role', 'Update Role', 'Update Role', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(4, 'delete-role', 'Delete Role', 'Delete Role', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(5, 'read-permission', 'Read Permission', 'Read Permission', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(6, 'update-permission', 'Update Permission', 'Update Permission', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(7, 'delete-permission', 'Delete Permission', 'Delete Permission', 1, '2018-06-06 10:24:36', '2018-07-02 05:29:53'),
	(8, 'create-permission', 'Create Permission', 'Create permission', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(9, 'create-pemasangan-baru', 'Membuat Data Pemasangan Baru', 'Membuat data pemasangan baru', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(10, 'delete-pemasangan-baru', 'Menghapus Data Pemasangan Baru', 'Menghapus data Pemasangan Baru', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(11, 'lihat-pemasangan-baru', 'Melihat Data Pemasangan Baru', 'Melihat data pemasangan baru', 1, '2018-07-02 10:24:36', '2018-07-02 10:24:36'),
	(12, 'update-pemasangan-baru', 'Mengubah Data Pemasangan Baru', 'Mengubah data pemasangan baru', 1, '2018-07-02 10:24:36', '2018-07-02 10:24:36'),
	(13, 'approve-pemasangan-baru', 'Menyetujui Pemasangan Baru', 'Menyetujui Pemasangan Baru', 1, '2018-07-02 10:24:36', '2018-07-02 10:24:36'),
	(14, 'approve-rab', 'Menyetujui RAB', 'Menyetujui RAB', 1, '2018-07-02 10:24:36', '2018-07-02 10:24:36'),
	(15, 'lihat-survey', 'Melihat Data Survei', 'Melihat Data Survei', 1, '2018-07-02 15:26:26', '2018-07-02 15:26:28'),
	(16, 'lihat-rab', 'Melihat Data RAB', 'Melihat Data RAB', 1, '2018-07-02 15:26:27', '2018-07-02 15:26:29'),
	(17, 'update-survey', 'Mengubah Data Survei', 'Mengubah Data Survei', 1, '2018-07-02 15:43:21', '2018-07-02 15:43:21'),
	(18, 'lihat-semua-pb', 'Melihat Semua Data PB', 'Melihat Semua Data Pemasangan Baru yang masuk', 1, '2018-07-03 13:33:35', '2018-07-03 13:33:35');

-- Dumping structure for table pdam_web.roles
CREATE TABLE IF NOT EXISTS `roles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `display_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `built_in` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table pdam_web.roles: ~8 rows (approximately)
DELETE FROM `roles`;
INSERT INTO `roles` (`id`, `name`, `display_name`, `description`, `built_in`, `created_at`, `updated_at`) VALUES
	(1, 'super-admin', 'Super Admin', 'Super Admin', 1, '2018-06-06 10:24:36', '2018-06-06 10:24:36'),
	(2, 'pengguna', 'Pengguna', 'End-user, pengguna yang mendaftar via web', 0, '2018-07-02 05:56:09', '2018-07-02 05:56:09'),
	(3, 'p2k', 'P2K', 'Petugas P2K', 0, '2018-07-02 05:56:44', '2018-07-02 05:56:44'),
	(4, 'vip_p2k', 'VIP P2K', 'Spv dan Manager P2K', 0, '2018-07-02 05:57:26', '2018-07-02 05:57:26'),
	(5, 'pjsr', 'PJSR', 'Petugas PJSR', 0, '2018-07-02 05:57:57', '2018-07-02 05:57:57'),
	(6, 'vip_pjsr', 'VIP PJSR', 'Spv dan Manager PJSR', 0, '2018-07-02 05:58:39', '2018-07-02 05:58:39'),
	(7, 'ptjsr', 'PTJSR', 'Petugas PTJSR', 0, '2018-07-02 05:59:10', '2018-07-02 05:59:10'),
	(8, 'vip_ptjsr', 'VIP PTJSR', 'Spv dan Manager PTJSR', 0, '2018-07-02 05:59:57', '2018-07-02 05:59:57'),
	(9, 'surveyor', 'Surveyor', 'Surveyor', 0, '2018-07-02 09:04:43', '2018-07-02 09:04:43');

-- Dumping structure for table pdam_web.role_user
CREATE TABLE IF NOT EXISTS `role_user` (
  `role_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `user_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`,`role_id`,`user_type`),
  KEY `role_user_role_id_foreign` (`role_id`),
  CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table pdam_web.role_user: ~6 rows (approximately)
DELETE FROM `role_user`;
INSERT INTO `role_user` (`role_id`, `user_id`, `user_type`) VALUES
	(1, 1, 'App\\User'),
	(2, 2, 'App\\User'),
	(2, 3, 'App\\User'),
	(2, 4, 'App\\User'),
	(9, 5, 'App\\User'),
	(9, 89, 'App\\User'),
	(9, 90, 'App\\User'),
	(9, 91, 'App\\User'),
	(9, 92, 'App\\User'),
	(9, 93, 'App\\User'),
	(9, 94, 'App\\User'),
	(9, 95, 'App\\User'),
	(9, 96, 'App\\User'),
	(9, 97, 'App\\User'),
	(9, 98, 'App\\User'),
	(9, 99, 'App\\User'),
	(9, 100, 'App\\User'),
	(9, 101, 'App\\User'),
	(9, 102, 'App\\User'),
	(9, 103, 'App\\User'),
	(9, 104, 'App\\User'),
	(9, 105, 'App\\User'),
	(9, 106, 'App\\User'),
	(9, 107, 'App\\User'),
	(9, 108, 'App\\User'),
	(9, 109, 'App\\User'),
	(9, 110, 'App\\User'),
	(9, 111, 'App\\User'),
	(9, 112, 'App\\User'),
	(9, 113, 'App\\User'),
	(9, 114, 'App\\User'),
	(9, 115, 'App\\User'),
	(9, 116, 'App\\User'),
	(9, 117, 'App\\User'),
	(9, 118, 'App\\User'),
	(9, 119, 'App\\User'),
	(9, 120, 'App\\User'),
	(9, 121, 'App\\User'),
	(9, 122, 'App\\User'),
	(9, 123, 'App\\User'),
	(9, 124, 'App\\User'),
	(9, 125, 'App\\User'),
	(9, 126, 'App\\User'),
	(9, 127, 'App\\User'),
	(9, 128, 'App\\User');

