Просмотр файла database/migrations/20180420180019_create_forums_table.php

Размер файла: 1Kb
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. use App\Migrations\Migration;
  6. use Illuminate\Database\Schema\Blueprint;
  7.  
  8. final class CreateForumsTable extends Migration
  9. {
  10. /**
  11. * Migrate Up.
  12. */
  13. public function up(): void
  14. {
  15. if (! $this->schema->hasTable('forums')) {
  16. $this->schema->create('forums', function (Blueprint $table) {
  17. $table->increments('id');
  18. $table->integer('sort')->default(0);
  19. $table->integer('parent_id')->default(0);
  20. $table->string('title', 50);
  21. $table->string('description', 100)->nullable();
  22. $table->integer('last_topic_id')->default(0);
  23. $table->boolean('closed')->default(false);
  24. $table->integer('count_topics')->default(0);
  25. $table->integer('count_posts')->default(0);
  26. });
  27. }
  28. }
  29.  
  30. /**
  31. * Migrate Down.
  32. */
  33. public function down(): void
  34. {
  35. $this->schema->dropIfExists('forums');
  36. }
  37. }