32 lines
872 B
PHP
32 lines
872 B
PHP
|
|
<?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('ticket_messages', function (Blueprint $table) {
|
||
|
|
$table->increments('id');
|
||
|
|
|
||
|
|
$table->text('message')->nullable();
|
||
|
|
$table->boolean('hidden')->default(false);
|
||
|
|
|
||
|
|
$table->unsignedInteger('ticket_id');
|
||
|
|
$table->foreign('ticket_id')->references('id')->on('tickets')->cascadeOnDelete();
|
||
|
|
|
||
|
|
$table->unsignedInteger('author_id')->nullable();
|
||
|
|
$table->foreign('author_id')->references('id')->on('users')->nullOnDelete();
|
||
|
|
|
||
|
|
$table->timestamps();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down(): void
|
||
|
|
{
|
||
|
|
Schema::dropIfExists('ticket_messages');
|
||
|
|
}
|
||
|
|
};
|