25 lines
821 B
PHP
25 lines
821 B
PHP
<?php
|
|
// Script untuk membuat tabel jalan_rusak jika belum ada
|
|
include 'db_config.php';
|
|
|
|
$sql = "CREATE TABLE IF NOT EXISTS jalan_rusak (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
latitude DECIMAL(10, 8) NOT NULL,
|
|
longitude DECIMAL(11, 8) NOT NULL,
|
|
jenis_kerusakan VARCHAR(100) NOT NULL COMMENT 'Jenis: lubang, retak, ambles, dll',
|
|
deskripsi TEXT,
|
|
severity VARCHAR(50) DEFAULT 'sedang' COMMENT 'tertarik: ringan, sedang, berat',
|
|
gambar VARCHAR(255),
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
INDEX idx_coords (latitude, longitude)
|
|
)";
|
|
|
|
if ($conn->query($sql) === TRUE) {
|
|
echo json_encode(['status' => 'success', 'message' => 'Tabel jalan_rusak berhasil dibuat atau sudah ada']);
|
|
} else {
|
|
echo json_encode(['status' => 'error', 'message' => $conn->error]);
|
|
}
|
|
|
|
$conn->close();
|
|
?>
|