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

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