2016_01_14_154209_create_articles_table.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateArticlesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('articles', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->integer('user_id')->unsigned()->index(); //文章发起人
  17. $table->string('title',255); //文章标题
  18. $table->string('summary',255); //导读、摘要
  19. $table->text('content'); //文章内容
  20. $table->integer('views')->unsigned()->default(0); //查看数
  21. $table->integer('collections')->unsigned()->default(0); //收藏数
  22. $table->integer('comments')->unsigned()->default(0); //评论数
  23. $table->integer('supports')->unsigned()->default(0); //支持数、推荐数目
  24. $table->tinyInteger('status')->default(0); //状态0待审核,1已审核
  25. $table->tinyInteger('device')->default(1); //提问设备类型1pc,2安卓,3IOS,4weixin
  26. $table->timestamps();
  27. });
  28. }
  29. /**
  30. * Reverse the migrations.
  31. *
  32. * @return void
  33. */
  34. public function down()
  35. {
  36. Schema::drop('articles');
  37. }
  38. }