2019_06_03_162449_create_table_post_comment.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateTablePostComment extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('post_comment', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->integer('post_id')
  17. ->index('post_id')
  18. ->comment('帖子id');
  19. $table->integer('parent_id')
  20. ->default(0)
  21. ->comment('评论id');
  22. $table->integer('uid')
  23. ->index('uid')
  24. ->unsigned()
  25. ->comment('uid');
  26. $table->string('username', 32)
  27. ->default('')
  28. ->comment('昵称');
  29. $table->string('avatar', 255)
  30. ->default('')
  31. ->comment('头像');
  32. $table->string('content', 200)
  33. ->default('')
  34. ->comment('评论内容');
  35. $table->integer('praise_count')
  36. ->default(0)
  37. ->comment('点赞数');
  38. $table->tinyInteger('is_delete')
  39. ->default(0)
  40. ->comment('是否删除:0否,1是');
  41. $table->timestamps();
  42. });
  43. }
  44. /**
  45. * Reverse the migrations.
  46. *
  47. * @return void
  48. */
  49. public function down()
  50. {
  51. Schema::dropIfExists('post_comment');
  52. }
  53. }