CREATE DATABASE IF NOT EXISTS webgis_spbu_p1;
USE webgis_spbu_p1;

DROP TABLE IF EXISTS spbu;
CREATE TABLE spbu (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_spbu VARCHAR(150) NOT NULL,
    alamat TEXT NULL,
    status_24_jam ENUM('Ya', 'Tidak') NOT NULL DEFAULT 'Tidak',
    kontak VARCHAR(50) NULL,
    geojson LONGTEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

INSERT INTO spbu (nama_spbu, alamat, status_24_jam, kontak, geojson) VALUES
('SPBU Ahmad Yani', 'Jl. Ahmad Yani, Pontianak', 'Ya', '081234567890', '{"type":"Point","coordinates":[109.3425,-0.0442]}'),
('SPBU Gajah Mada', 'Jl. Gajah Mada, Pontianak', 'Tidak', '081234567891', '{"type":"Point","coordinates":[109.3338,-0.0271]}');
