2025_11_09_131804_create_chats_table.php 716 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. use App\Models\User;
  3. use Illuminate\Database\Migrations\Migration;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Support\Facades\Schema;
  6. return new class extends Migration {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('chats', function (Blueprint $table) {
  13. $table->uuid('id')->primary();
  14. $table->string('title')->nullable();
  15. $table->foreignIdFor(User::class)->constrained()->cascadeOnUpdate()->cascadeOnDelete();
  16. $table->timestamps();
  17. });
  18. }
  19. /**
  20. * Reverse the migrations.
  21. */
  22. public function down(): void
  23. {
  24. Schema::dropIfExists('chats');
  25. }
  26. };