Просмотр файла database/migrations/20180420180007_create_blogs_table.php

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