CREATE DATABASE IF NOT EXISTS webgis_jalan;
USE webgis_jalan;

CREATE TABLE IF NOT EXISTS jalan (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_jalan VARCHAR(255) NOT NULL,
    status ENUM('Jalan Nasional', 'Jalan Provinsi', 'Jalan Kabupaten') NOT NULL,
    panjang DECIMAL(10, 2) NOT NULL,
    geojson LONGTEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS parsil (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_pemilik VARCHAR(255) NOT NULL,
    status ENUM('SHM', 'HGB', 'HGU', 'HP') NOT NULL,
    luas DECIMAL(12, 2) NOT NULL,
    geojson LONGTEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS titik_rusak (
    id INT AUTO_INCREMENT PRIMARY KEY,
    keterangan VARCHAR(255) NOT NULL,
    foto_url VARCHAR(255) NOT NULL,
    geojson LONGTEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
