id('LokasiId'); $table->unsignedInteger('PerusahaanId'); $table->string('Nama', 255); $table->double('Lintang')->nullable()->comment('lintang in decimal degree'); $table->double('Bujur')->nullable()->comment('bujur in decimal degree'); $table->tinyInteger('Tipe')->unsigned()->default(0)->comment('0=kebisingan ambien, 1=udara ambien'); // Karena Laravel tidak mendukung tipe SET, kita gunakan ENUM sebagai gantinya $table->enum('BakuMutuJenis', ['Angka Tunggal', 'Rentang Angka', 'Positif/Negatif']); $table->string('BakuMutuNilai1', 45); $table->string('BakuMutuNilai2', 45)->nullable(); $table->enum('Del', ['y', 'n']); $table->index('PerusahaanId', 'IndexLokasi_PerusahaanId'); $table->foreign('PerusahaanId') ->references('PerusahaanId') ->on('Perusahaan') ->onDelete('cascade'); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('Lokasi', function (Blueprint $table) { $table->dropForeign(['PerusahaanId']); }); Schema::dropIfExists('Lokasi'); } };