File: /mnt/data/ghayatcom/ghayatcom-api/database/migrations/2021_12_21_100324_create_chats_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateChatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('chats', function (Blueprint $table) {
$table->id();
$table->foreignId('appointment_id')->nullable()->constrained('appointments');
$table->foreignId('sender_id')->nullable()->constrained('users');
$table->foreignId('recipient_id')->nullable()->constrained('users');
$table->text('message')->nullable();
$table->string('file_path')->nullable();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrentOnUpdate();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('chats');
}
}