refactor: update timestamp fields in multiple migration files to use current timestamps and nullable updates

This commit is contained in:
Yoga Pangestu 2026-01-07 19:01:54 +07:00
parent f545271040
commit df8ef13552
5 changed files with 9 additions and 5 deletions

View File

@ -15,7 +15,8 @@ public function up(): void
$table->id();
$table->foreignId('broadcast_id')->constrained()->cascadeOnDelete();
$table->foreignId('audience_id')->constrained('roles')->cascadeOnDelete();
$table->timestamps();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
});
}

View File

@ -22,7 +22,8 @@ public function up(): void
$table->enum('is_show', IsShow::values())->default(IsShow::SHOW)->comment(IsShow::comment());
$table->date('start_date');
$table->date('end_date')->nullable();
$table->timestamps();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
$table->softDeletes();
});
}

View File

@ -22,7 +22,8 @@ public function up(): void
$table->timestamp('expires_at');
$table->timestamp('verified_at')->nullable();
$table->foreignId('verified_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
$table->softDeletes();
});
}

View File

@ -18,7 +18,8 @@ public function up(): void
$table->text('content');
$table->integer('rating');
$table->enum('is_show', IsShow::values())->default(IsShow::SHOW)->comment(IsShow::comment());
$table->timestamps();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
});
}

View File

@ -17,7 +17,7 @@
// User needs a referral code to display it
ReferralCode::factory()->for($this->user)->create([
'code' => 'YADI123'
'code' => 'YADI123',
]);
Livewire::test(Referral::class)