initial commit
This commit is contained in:
36
database/migrations/2024_08_12_200626_adding_new_coluns.php
Normal file
36
database/migrations/2024_08_12_200626_adding_new_coluns.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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');
|
||||
});
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user