Lae/database/migrations/2023_02_02_000000_create_notifications_table.php

37 lines
856 B
PHP
Raw Normal View History

2022-08-13 08:37:17 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
2023-01-30 16:14:07 +00:00
return new class extends Migration
{
2022-08-13 08:37:17 +00:00
/**
* Run the migrations.
*
* @return void
*/
2023-01-14 10:02:27 +00:00
public function up(): void
2022-08-13 08:37:17 +00:00
{
2022-08-13 08:42:23 +00:00
Schema::create('notifications', function (Blueprint $table) {
2023-02-02 12:11:41 +00:00
$table->uuid()->primary();
2022-08-13 08:42:23 +00:00
$table->string('type');
2023-02-02 12:11:41 +00:00
$table->string('notifiable_type')->index();
$table->unsignedBigInteger('notifiable_id')->index();
2022-08-13 08:42:23 +00:00
$table->text('data');
$table->timestamp('read_at')->nullable();
2022-08-13 08:37:17 +00:00
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
2023-01-14 10:02:27 +00:00
public function down(): void
2022-08-13 08:37:17 +00:00
{
2022-08-13 08:42:23 +00:00
Schema::dropIfExists('notifications');
2022-08-13 08:37:17 +00:00
}
};