2021_07_29_014835_create_polls_table.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreatePollsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('polls', function (Blueprint $table) {
  15. $table->bigInteger('id')->unsigned()->primary();
  16. $table->bigInteger('story_id')->unsigned()->nullable()->index();
  17. $table->bigInteger('status_id')->unsigned()->nullable()->index();
  18. $table->bigInteger('group_id')->unsigned()->nullable()->index();
  19. $table->bigInteger('profile_id')->unsigned()->index();
  20. $table->json('poll_options')->nullable();
  21. $table->json('cached_tallies')->nullable();
  22. $table->boolean('multiple')->default(false);
  23. $table->boolean('hide_totals')->default(false);
  24. $table->unsignedInteger('votes_count')->default(0);
  25. $table->timestamp('last_fetched_at')->nullable();
  26. $table->timestamp('expires_at')->nullable();
  27. $table->timestamps();
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. *
  33. * @return void
  34. */
  35. public function down()
  36. {
  37. Schema::dropIfExists('polls');
  38. }
  39. }