Skip to content

Commit

Permalink
add migration file
Browse files Browse the repository at this point in the history
  • Loading branch information
mgamal92 committed Feb 17, 2024
1 parent 0c96213 commit 61dd493
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions database/migrations/2024_02_17_000001_create_inbox_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::create('inbox', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('sender_id');
$table->unsignedBigInteger('receiver_id');
$table->text('subject')->nullable();
$table->text('body');
$table->boolean('is_read')->default(false);
$table->boolean('is_starred')->default(false);
$table->timestamps();
$table->softDeletes();

$table->foreign('sender_id')->references('user_id')->on('users')->onDelete('cascade');
$table->foreign('receiver_id')->references('user_id')->on('users')->onDelete('cascade');
});
}

public function down(): void
{
Schema::dropIfExists('laravel_inbox_table');
}
};

0 comments on commit 61dd493

Please sign in to comment.