39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateNotificationsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('notifications', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('user_id');
|
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
|
$table->string('title')->nullable();
|
|
$table->string('type')->nullable();
|
|
$table->text('message')->nullable();
|
|
$table->json('extra_fields')->nullable();
|
|
$table->enum('status', [0,1])->comment('0=> Unread, 1=>Read')->default(0);
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('notifications');
|
|
}
|
|
}
|