Просмотр файла database/migrations/20180420180050_create_votes_table.php

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