From 354eb34358ec69e0396808c1ff213c3fa738e16e Mon Sep 17 00:00:00 2001 From: pancaa Date: Wed, 10 Jun 2026 15:17:26 +0000 Subject: [PATCH] Update database/webgis_bansos.sql --- database/webgis_bansos.sql | 116 ++++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 40 deletions(-) diff --git a/database/webgis_bansos.sql b/database/webgis_bansos.sql index 71cfed1..5727639 100644 --- a/database/webgis_bansos.sql +++ b/database/webgis_bansos.sql @@ -1,59 +1,95 @@ --- phpMyAdmin SQL Dump --- version 5.2.1 --- https://www.phpmyadmin.net/ --- --- Host: 127.0.0.1 --- Generation Time: Jun 10, 2026 at 07:36 AM --- Server version: 10.4.32-MariaDB --- PHP Version: 8.0.30 +CREATE TABLE religious_centers ( +id INT AUTO_INCREMENT PRIMARY KEY, +name VARCHAR(255) NOT NULL, +address TEXT, +kas DECIMAL(15,2) DEFAULT 0, +latitude DOUBLE NOT NULL, +longitude DOUBLE NOT NULL, +radius INT DEFAULT 300 +); -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -START TRANSACTION; -SET time_zone = "+00:00"; +CREATE TABLE houses ( +id INT AUTO_INCREMENT PRIMARY KEY, +latitude DOUBLE NOT NULL, +longitude DOUBLE NOT NULL, +address TEXT, +rt VARCHAR(20), +rw VARCHAR(20), +kelurahan VARCHAR(100), +status_miskin VARCHAR(50), +jumlah_anggota INT DEFAULT 0, +anggota LONGTEXT, +aid_status VARCHAR(50) DEFAULT 'outside', +has_data TINYINT(1) DEFAULT 0 +); +CREATE TABLE laporan ( +id INT AUTO_INCREMENT PRIMARY KEY, +pelapor VARCHAR(255) DEFAULT 'Anonim', +deskripsi TEXT NOT NULL, +foto_base64 LONGTEXT, +created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); -/*!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 */; +CREATE TABLE aid_logs ( +id INT AUTO_INCREMENT PRIMARY KEY, +house_id INT, +religious_center_id INT, +status VARCHAR(50), +timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE `password_resets` ( + `id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + `email` varchar(255) NOT NULL, + `status` enum('pending','done') DEFAULT 'pending', + `created_at` timestamp NOT NULL DEFAULT current_timestamp() +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +CREATE TABLE `users` ( + `id` int(11) NOT NULL, + `nama` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `role` enum('admin','surveyer','viewer') DEFAULT 'viewer', + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `status` enum('pending','approved','rejected') DEFAULT 'pending' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +ALTER TABLE `password_resets` + ADD PRIMARY KEY (`id`), + ADD KEY `user_id` (`user_id`); -- --- Database: `webgis_bansos` +-- Indexes for table `users` -- - --- -------------------------------------------------------- +ALTER TABLE `users` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `email` (`email`); -- --- Table structure for table `aid_logs` --- --- Error reading structure for table webgis_bansos.aid_logs: #1932 - Table 'webgis_bansos.aid_logs' doesn't exist in engine --- Error reading data for table webgis_bansos.aid_logs: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `webgis_bansos`.`aid_logs`' at line 1 - --- -------------------------------------------------------- -- --- Table structure for table `houses` +-- AUTO_INCREMENT for table `password_resets` -- --- Error reading structure for table webgis_bansos.houses: #1932 - Table 'webgis_bansos.houses' doesn't exist in engine --- Error reading data for table webgis_bansos.houses: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `webgis_bansos`.`houses`' at line 1 - --- -------------------------------------------------------- +ALTER TABLE `password_resets` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- --- Table structure for table `laporan` +-- AUTO_INCREMENT for table `users` -- --- Error reading structure for table webgis_bansos.laporan: #1932 - Table 'webgis_bansos.laporan' doesn't exist in engine --- Error reading data for table webgis_bansos.laporan: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `webgis_bansos`.`laporan`' at line 1 - --- -------------------------------------------------------- +ALTER TABLE `users` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- --- Table structure for table `religious_centers` +-- Constraints for dumped tables -- --- Error reading structure for table webgis_bansos.religious_centers: #1932 - Table 'webgis_bansos.religious_centers' doesn't exist in engine --- Error reading data for table webgis_bansos.religious_centers: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `webgis_bansos`.`religious_centers`' at line 1 + +-- +-- Constraints for table `password_resets` +-- +ALTER TABLE `password_resets` + ADD CONSTRAINT `password_resets_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; 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 */;