2016_07_25_130523_create_articles_table.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use Illuminate\Database\Schema\Blueprint;
  3. use Illuminate\Database\Migrations\Migration;
  4. class CreateArticlesTable extends Migration
  5. {
  6. /**
  7. * Run the migrations.
  8. *
  9. * @return void
  10. */
  11. public function up()
  12. {
  13. Schema::create('articles', function(Blueprint $table) {
  14. $table->increments('id');
  15. $table->string('title', 200)->default('')->comment('文章标题');
  16. $table->string('keyword')->default('')->comment('keywords');
  17. $table->string('desc')->default('')->comment('描述');
  18. $table->longText('content')->nullable()->comment('文章内容,markdown格式');
  19. $table->integer('user_id')->default(0)->comment('文章编写人,对应users表');
  20. $table->integer('cate_id')->default(0)->comment('文章分类');
  21. $table->integer('comment_count')->default(0)->comment('评论数量');
  22. $table->integer('read_count')->default(0)->comment('阅读数量');
  23. $table->tinyInteger('status')->default(0)->comment('文章状态:0-公开;1-私密');
  24. $table->integer('sort')->default(0)->comment('排序');
  25. $table->timestamps();
  26. $table->index('cate_id');
  27. $table->index('user_id');
  28. $table->index('title');
  29. $table->index('created_at');
  30. });
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. Schema::drop('articles');
  40. }
  41. }