2019_06_03_162449_create_table_post_comment.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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->tinyInteger('is_delete')
  36. ->default(0)
  37. ->comment('是否删除:0否,1是');
  38. $table->timestamps();
  39. });
  40. }
  41. /**
  42. * Reverse the migrations.
  43. *
  44. * @return void
  45. */
  46. public function down()
  47. {
  48. Schema::dropIfExists('post_comment');
  49. }
  50. }