-- Database dan tabel aplikasi WebGIS
CREATE DATABASE IF NOT EXISTS `03_webgisdb`
CHARACTER SET utf8mb4
COLLATE utf8mb4_general_ci;

USE `03_webgisdb`;

CREATE TABLE IF NOT EXISTS `jalan` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `nama_jalan` VARCHAR(150) NOT NULL,
  `status_jalan` ENUM('nasional','provinsi','kabupaten') NOT NULL,
  `panjang_meter` DOUBLE NOT NULL,
  `geojson` LONGTEXT 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 IF NOT EXISTS `parsil_tanah` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `nama_parsil` VARCHAR(150) NOT NULL,
  `status_kepemilikan` ENUM('SHM','HGB','HGU','HP') NOT NULL,
  `luas_meter` DOUBLE NOT NULL,
  `geojson` LONGTEXT NOT NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
