Просмотр файла database/migrations/20180420180009_create_chats_table.php

Размер файла: 935B
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. use App\Migrations\Migration;
  6. use Illuminate\Database\Schema\Blueprint;
  7.  
  8. final class CreateChatsTable extends Migration
  9. {
  10. /**
  11. * Migrate Up.
  12. */
  13. public function up(): void
  14. {
  15. if (! $this->schema->hasTable('chats')) {
  16. $this->schema->create('chats', function (Blueprint $table) {
  17. $table->increments('id');
  18. $table->integer('user_id');
  19. $table->text('text');
  20. $table->ipAddress('ip');
  21. $table->string('brow', 25);
  22. $table->integer('edit_user_id')->nullable();
  23. $table->integer('updated_at')->nullable();
  24. $table->integer('created_at');
  25.  
  26. $table->index('created_at');
  27. });
  28. }
  29. }
  30.  
  31. /**
  32. * Migrate Down.
  33. */
  34. public function down(): void
  35. {
  36. $this->schema->dropIfExists('chats');
  37. }
  38. }