| Current Path : /var/www/html/LLCF-APP/database/migrations/ |
| Current File : //var/www/html/LLCF-APP/database/migrations/2025_08_03_190518_create_student_table.php |
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('student', function (Blueprint $table) {
$table->increments('id');
$table->string('stu_full_name', 45);
$table->date('stu_dob')->nullable();
$table->string('stu_gender', 45);
$table->integer('gr_num')->unique('gr_num_unique');
$table->string('auto_gr_num', 45)->unique('auto_gr_num_unique');
$table->string('class', 45);
$table->unsignedInteger('family_id');
$table->unsignedInteger('donor_id')->nullable();
$table->timestamp('donation_date')->nullable();
$table->timestamp('donation_expiry')->nullable();
$table->timestamp('created_on')->useCurrent();
$table->timestamp('updated_on')->nullable()->useCurrentOnUpdate();
$table->foreign('family_id')->references('id')->on('family')->onDelete('cascade');
$table->foreign('donor_id')->references('id')->on('donor')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('student');
}
};