Просмотр файла database/migrations/20180420180029_create_notebooks_table.php

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