Просмотр файла database/migrations/2018_04_20_180003_create_banhist_table.php

Размер файла: 1.06Kb
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. use Illuminate\Database\Migrations\Migration;
  6. use App\Models\Banhist;
  7. use Illuminate\Database\Schema\Blueprint;
  8. use Illuminate\Support\Facades\Schema;
  9.  
  10. final class CreateBanhistTable extends Migration
  11. {
  12. /**
  13. * Migrate Up.
  14. */
  15. public function up(): void
  16. {
  17. if (! Schema::hasTable('banhist')) {
  18. Schema::create('banhist', function (Blueprint $table) {
  19. $table->increments('id');
  20. $table->integer('user_id');
  21. $table->integer('send_user_id');
  22. $table->enum('type', [Banhist::BAN, Banhist::UNBAN, Banhist::CHANGE]);
  23. $table->text('reason');
  24. $table->integer('term')->default(0);
  25. $table->integer('created_at');
  26. $table->boolean('explain')->default(false);
  27.  
  28. $table->index('user_id');
  29. $table->index('created_at');
  30. });
  31. }
  32. }
  33.  
  34. /**
  35. * Migrate Down.
  36. */
  37. public function down(): void
  38. {
  39. Schema::dropIfExists('banhist');
  40. }
  41. }