-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `warga_kemangasri`
--

-- --------------------------------------------------------

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `kartu_keluarga`
--

CREATE TABLE `kartu_keluarga` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `foto_rumah` varchar(255) DEFAULT NULL,
  `nama_kepala_keluarga` varchar(255) NOT NULL,
  `no_kk` varchar(255) NOT NULL,
  `alamat` text DEFAULT NULL,
  `rt_id` bigint(20) UNSIGNED NOT NULL,
  `status_ekonomi` varchar(255) NOT NULL,
  `range_penghasilan` varchar(255) DEFAULT NULL,
  `jumlah_individu` int(11) NOT NULL DEFAULT 0,
  `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 `kartu_keluarga`
--

INSERT INTO `kartu_keluarga` (`id`, `foto_rumah`, `nama_kepala_keluarga`, `no_kk`, `alamat`, `rt_id`, `status_ekonomi`, `range_penghasilan`, `jumlah_individu`, `created_at`, `updated_at`) VALUES
(30, '1773116810_1770869002.jpeg', 'riyan', '6548548549589458', NULL, 9, 'Mampu', NULL, 7, '2026-03-09 21:26:50', '2026-03-09 21:39:16');

-- --------------------------------------------------------

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_reset_tokens_table', 1),
(3, '2014_10_12_100000_create_password_resets_table', 1),
(4, '2019_08_19_000000_create_failed_jobs_table', 1),
(5, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(6, '2025_11_24_064821_create_rw_table', 2),
(7, '2025_11_24_064838_create_rt_table', 2),
(8, '2025_11_24_072134_create_kartu_keluarga_table', 3),
(9, '2025_11_24_074321_create_penduduk_table', 4),
(10, '2025_11_24_101411_add_columns_to_penduduk_table', 5),
(11, '2025_01_01_000001_add_role_to_users_table', 6),
(12, '2025_12_09_032246_add_rw_rt_to_users_table', 7),
(13, '2025_12_11_063322_add_nik_to_users_table', 8),
(14, '2025_12_11_093600_add_kartu_keluarga_id_to_users_table', 9),
(15, '2025_12_12_064021_add_no_kk_to_users_table', 10),
(16, '2025_12_15_043312_add_foto_profil_to_users_table', 11),
(17, '2025_12_17_042545_add_range_penghasilan_to_users_table', 12),
(18, '2025_12_17_043207_add_range_penghasilan_to_kartu_keluarga_table', 13),
(19, '2025_12_17_073103_add_range_penghasilan_to_penduduk_table', 14),
(20, '2025_12_18_030647_add_alamat_to_kartu_keluarga_table', 15),
(21, '2025_12_18_030937_add_alamat_to_kartu_keluarga_table', 16),
(22, '2025_12_19_071415_add_no_telp_to_penduduk_table', 17),
(23, '2025_12_21_143115_add_kelamin_to_penduduk_table', 18);

-- --------------------------------------------------------

--
-- Table structure for table `penduduk`
--

CREATE TABLE `penduduk` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `nama` varchar(255) NOT NULL,
  `nik` varchar(255) NOT NULL,
  `kelamin` varchar(255) DEFAULT NULL,
  `no_kk` varchar(255) DEFAULT NULL,
  `kartu_keluarga_id` bigint(20) UNSIGNED NOT NULL,
  `alamat` text DEFAULT NULL,
  `no_telp` varchar(255) DEFAULT NULL,
  `agama` varchar(255) DEFAULT NULL,
  `tempat_lahir` varchar(255) DEFAULT NULL,
  `tanggal_lahir` date DEFAULT NULL,
  `usia` int(11) DEFAULT NULL,
  `status_keluarga` varchar(255) DEFAULT NULL,
  `pekerjaan` varchar(255) DEFAULT NULL,
  `range_penghasilan` varchar(255) DEFAULT NULL,
  `status_pernikahan` varchar(255) 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 `penduduk`
--

INSERT INTO `penduduk` (`id`, `nama`, `nik`, `kelamin`, `no_kk`, `kartu_keluarga_id`, `alamat`, `no_telp`, `agama`, `tempat_lahir`, `tanggal_lahir`, `usia`, `status_keluarga`, `pekerjaan`, `range_penghasilan`, `status_pernikahan`, `created_at`, `updated_at`) VALUES
(30, 'riyan', '6597698695685986', 'Laki-Laki', '6548548549589458', 30, NULL, NULL, NULL, NULL, NULL, NULL, 'Kepala Keluarga', NULL, NULL, NULL, '2026-03-09 21:26:50', '2026-03-09 21:26:50'),
(31, 'lala', '7659685965096059', 'Perempuan', '6548548549589458', 30, NULL, NULL, 'Islam', NULL, '2026-03-10', 0, 'Istri', NULL, '> Rp 5.000.000', 'Menikah', '2026-03-09 21:27:25', '2026-03-09 21:27:25'),
(32, 'kinan', '6483394839853958', 'Perempuan', '6548548549589458', 30, 'jakarta', '84095038', 'Islam', 'jakarta', '2026-03-10', 0, 'Anak', 'wiraswatsa', '< Rp 500.000', 'Belum Menikah', '2026-03-09 21:39:16', '2026-03-09 21:39:16');

-- --------------------------------------------------------

--
-- Table structure for table `rt`
--

CREATE TABLE `rt` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `ketua_rt` varchar(255) NOT NULL,
  `rt` int(11) NOT NULL,
  `rw_id` bigint(20) UNSIGNED NOT NULL,
  `periode_start` int(11) NOT NULL,
  `periode_end` int(11) NOT 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 `rt`
--

INSERT INTO `rt` (`id`, `ketua_rt`, `rt`, `rw_id`, `periode_start`, `periode_end`, `created_at`, `updated_at`) VALUES
(9, 'Rohimin', 6, 1, 2024, 2029, '2026-02-24 06:09:58', '2026-02-24 06:09:58');

-- --------------------------------------------------------

--
-- Table structure for table `rw`
--

CREATE TABLE `rw` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `ketua_rw` varchar(255) NOT NULL,
  `rw` int(11) NOT NULL,
  `periode_start` int(11) NOT NULL,
  `periode_end` int(11) NOT 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 `rw`
--

INSERT INTO `rw` (`id`, `ketua_rw`, `rw`, `periode_start`, `periode_end`, `created_at`, `updated_at`) VALUES
(1, 'Awan Setiawan', 1, 2024, 2029, '2025-11-23 23:59:28', '2026-01-08 19:38:28');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `kartu_keluarga`
--
ALTER TABLE `kartu_keluarga`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `kartu_keluarga_no_kk_unique` (`no_kk`),
  ADD KEY `kartu_keluarga_rt_id_foreign` (`rt_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `penduduk`
--
ALTER TABLE `penduduk`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `penduduk_nik_unique` (`nik`),
  ADD KEY `penduduk_kartu_keluarga_id_foreign` (`kartu_keluarga_id`);

--
-- Indexes for table `rt`
--
ALTER TABLE `rt`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rt_rw_id_foreign` (`rw_id`);

--
-- Indexes for table `rw`
--
ALTER TABLE `rw`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `kartu_keluarga`
--
ALTER TABLE `kartu_keluarga`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;

--
-- AUTO_INCREMENT for table `penduduk`
--
ALTER TABLE `penduduk`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;

--
-- AUTO_INCREMENT for table `rt`
--
ALTER TABLE `rt`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `rw`
--
ALTER TABLE `rw`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `kartu_keluarga`
--
ALTER TABLE `kartu_keluarga`
  ADD CONSTRAINT `kartu_keluarga_rt_id_foreign` FOREIGN KEY (`rt_id`) REFERENCES `rt` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `penduduk`
--
ALTER TABLE `penduduk`
  ADD CONSTRAINT `penduduk_kartu_keluarga_id_foreign` FOREIGN KEY (`kartu_keluarga_id`) REFERENCES `kartu_keluarga` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `rt`
--
ALTER TABLE `rt`
  ADD CONSTRAINT `rt_rw_id_foreign` FOREIGN KEY (`rw_id`) REFERENCES `rw` (`id`) ON DELETE CASCADE;
COMMIT;

