Просмотр файла database/migrations/20180420180035_create_pollings_table.php

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