diff --git a/database/migrations/2024_09_05_070712_create_penilaian_table.php b/database/migrations/2024_09_05_070712_create_penilaian_table.php index cb0a397..93670c0 100644 --- a/database/migrations/2024_09_05_070712_create_penilaian_table.php +++ b/database/migrations/2024_09_05_070712_create_penilaian_table.php @@ -20,10 +20,7 @@ return new class () extends Migration { $table->datetime('tanggal_kunjungan'); $table->text('keterangan')->nullable(); $table->string('status')->nullable(); - $table->string('nomor_registrasi')->references('nomor_registrasi')->on(Permohonan::class)->nullable(); - $table->integer('penilaian_id')->nullable(); - $table->integer('surveyor_id')->nullable(); - $table->integer('penilai_surveyor_id')->nullable(); + $table->unsignedBigInteger('user_id'); $table->timestamps(); $table->char('authorized_status', 1)->nullable(); $table->timestamp('authorized_at')->nullable(); diff --git a/database/migrations/2024_09_26_021850_update_penilaian_table.php b/database/migrations/2024_09_26_021850_update_penilaian_table.php index 80f7db0..91d680e 100644 --- a/database/migrations/2024_09_26_021850_update_penilaian_table.php +++ b/database/migrations/2024_09_26_021850_update_penilaian_table.php @@ -3,8 +3,9 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; + use Modules\Lpj\Models\Permohonan; -return new class extends Migration + return new class extends Migration { /** * Run the migrations. @@ -12,10 +13,11 @@ return new class extends Migration public function up(): void { Schema::table('penilaian', function (Blueprint $table) { + $table->dropColumn('user_id'); $table->string('nomor_registrasi')->references('nomor_registrasi')->on(Permohonan::class)->onDelete('cascade'); - $table->integer('penilai_id')->unsigned()->nullable(); - $table->integer('surveyor_id')->unsigned()->nullable(); - $table->integer('penilai_surveyor_id')->unsigned()->nullable(); + $table->unsignedBigInteger('penilaian_id')->unsigned()->nullable(); + $table->unsignedBigInteger('surveyor_id')->unsigned()->nullable(); + $table->unsignedBigInteger('penilai_surveyor_id')->unsigned()->nullable(); }); } @@ -25,12 +27,9 @@ return new class extends Migration public function down(): void { Schema::table('penilaian', function (Blueprint $table) { - $table->dropForeign(['nomor_registrasi']); - $table->dropForeign(['penilai_id']); - $table->dropForeign(['surveyor_id']); - $table->dropForeign(['penilai_surveyor_id']); + $table->unsignedBigInteger('user_id')->unsigned(); $table->dropColumn('nomor_registrasi'); - $table->dropColumn('penilai_id'); + $table->dropColumn('penilaian_id'); $table->dropColumn('surveyor_id'); $table->dropColumn('penilai_surveyor_id'); });