CREATE DATABASE IF NOT EXISTS kemiskinan_ibadah
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

USE kemiskinan_ibadah;

DROP TABLE IF EXISTS rumah_ibadah;
DROP TABLE IF EXISTS kemiskinan;

CREATE TABLE kemiskinan (
  id INT AUTO_INCREMENT PRIMARY KEY,
  nama_kk VARCHAR(200) NOT NULL,
  jumlah_kk INT NOT NULL DEFAULT 1,
  alamat TEXT NOT NULL,
  lat DECIMAL(10,7) NOT NULL,
  lng DECIMAL(10,7) NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE rumah_ibadah (
  id INT AUTO_INCREMENT PRIMARY KEY,
  nama_rumah_ibadah VARCHAR(200) NOT NULL,
  penanggung_jawab VARCHAR(200) NOT NULL,
  alamat TEXT NOT NULL,
  radius INT NOT NULL DEFAULT 500,
  lat DECIMAL(10,7) NOT NULL,
  lng DECIMAL(10,7) NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO kemiskinan (nama_kk, jumlah_kk, alamat, lat, lng) VALUES
('Siti Aminah', 4, 'Jl. Tanjung Raya II, Pontianak Timur', -0.0268500, 109.3611200),
('Budi Santoso', 5, 'Jl. Panglima Aim, Pontianak Timur', -0.0314200, 109.3553800),
('Rohani', 3, 'Gg. Karya Bakti, Pontianak Kota', -0.0226400, 109.3337600),
('M. Yusuf', 6, 'Jl. Kom Yos Sudarso, Pontianak Barat', -0.0149800, 109.3079200),
('Nurhayati', 2, 'Jl. Imam Bonjol, Pontianak Selatan', -0.0412200, 109.3420600),
('Hendra Saputra', 4, 'Jl. Parit H. Husin II, Pontianak Tenggara', -0.0556100, 109.3659200),
('Ramlah', 5, 'Jl. Gusti Situt Mahmud, Pontianak Utara', 0.0021400, 109.3288800),
('Agus Salim', 3, 'Jl. Sungai Raya Dalam, Pontianak Tenggara', -0.0614600, 109.3785400);

INSERT INTO rumah_ibadah (nama_rumah_ibadah, penanggung_jawab, alamat, radius, lat, lng) VALUES
('Masjid Raya Mujahidin', 'H. Ahmad Fauzi', 'Jl. Jenderal Ahmad Yani, Pontianak', 800, -0.0446400, 109.3369800),
('Gereja Katedral Santo Yosef', 'Pastor Markus', 'Jl. Pattimura, Pontianak Kota', 650, -0.0241300, 109.3374500),
('Vihara Bodhisatva Karaniya Metta', 'Lina Wijaya', 'Jl. Sultan Muhammad, Pontianak Kota', 500, -0.0212600, 109.3413400),
('Masjid Jami Sultan Syarif Abdurrahman', 'H. Sulaiman', 'Kampung Beting, Pontianak Timur', 700, -0.0264100, 109.3567600),
('Gereja HKBP Pontianak', 'St. Daniel Simanjuntak', 'Jl. Gajah Mada, Pontianak Selatan', 550, -0.0356200, 109.3459600),
('Pura Giripati Mulawarman', 'I Wayan Sudana', 'Jl. Adi Sucipto, Pontianak Tenggara', 500, -0.0643600, 109.3774200);
