2019_06_14_192526_create_table_post_like.php 813 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateTablePostLike extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('post_like', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->integer('uid')
  17. ->index('uid')
  18. ->comment('用户ID');
  19. $table->integer('post_id')
  20. ->default(0)
  21. ->comment('帖子id');
  22. $table->timestamps();
  23. });
  24. }
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down()
  31. {
  32. Schema::dropIfExists('post_like');
  33. }
  34. }