-- Tabel survey PJU di MySQL: nama tabel = `data_pju` (bukan `pju`).
-- Di error "Table 'pju.data_pju' doesn't exist": bagian `pju` = nama DATABASE (.env DB_DATABASE),
-- bagian `data_pju` = nama TABEL. Model Laravel [App\Models\DataPju] sudah memakai $table = 'data_pju'.
--
-- Sebelum import, pilih database yang benar, misalnya:
--   USE nama_database_anda;
--
-- Prefer: `php artisan migrate` dari folder project.
-- Pastikan tabel `users` sudah ada (foreign key user_id).

CREATE TABLE IF NOT EXISTS `data_pju` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nomor_pju` varchar(255) NOT NULL,
  `nama_jalan` varchar(255) DEFAULT NULL,
  `tinggi_tiang` decimal(8,2) NOT NULL,
  `panjang_lengan` decimal(8,2) NOT NULL,
  `jenis_lampu` varchar(255) NOT NULL,
  `latitude` decimal(10,7) NOT NULL,
  `longitude` decimal(10,7) NOT NULL,
  `foto_path` varchar(255) DEFAULT NULL,
  `tanggal_survey` date NOT NULL,
  `indikator_skor` text DEFAULT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `data_pju_user_id_foreign` (`user_id`),
  CONSTRAINT `data_pju_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
