2019_04_26_020035_create_comments_table.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateCommentsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('comments', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->string('content', 255)->default('')->comment('content');
  17. $table->string('uuid')->unique();
  18. $table->string('title', 255)->default('')->comment('title');
  19. $table->string('keywords')->default('')->comment('keywords');
  20. $table->longText('markdown')->nullable()->comment('markdown content');
  21. $table->integer('user_id')->default(0)->comment('author id');
  22. $table->integer('cate_id')->default(0)->comment('category id');
  23. $table->integer('comment_count')->default(0)->comment('comment count');
  24. $table->integer('read_count')->default(0)->comment('read count');
  25. $table->tinyInteger('status')->default(1)->comment('status: 1-public;0-private');
  26. $table->integer('sort')->default(0)->comment('sort');
  27. $table->tinyInteger('is_top')->default(0)->comment('sticky to top');
  28. $table->integer('updated_at');
  29. $table->integer('created_at');
  30. $table->integer('deleted_at')->nullable();
  31. $table->index('title');
  32. $table->index('cate_id');
  33. $table->index('user_id');
  34. $table->index('created_at');
  35. });
  36. }
  37. /**
  38. * Reverse the migrations.
  39. *
  40. * @return void
  41. */
  42. public function down()
  43. {
  44. Schema::dropIfExists('comments');
  45. }
  46. }