37 lines
958 B
PHP
37 lines
958 B
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::table('patient_notes', function (Blueprint $table) {
|
|
|
|
// Now, add the new polymorphic columns
|
|
$table->unsignedBigInteger('created_by_id')->nullable();
|
|
$table->string('created_by_type')->nullable();
|
|
|
|
// Add an index for better query performance
|
|
$table->index(['created_by_id', 'created_by_type']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::table('patient_notes', function (Blueprint $table) {
|
|
// Remove the new columns
|
|
$table->dropColumn('created_by_id');
|
|
$table->dropColumn('created_by_type');
|
|
});
|
|
}
|
|
};
|