2019_03_29_225247_create_course_articles_table.php 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * 教程书籍 文章表
  4. */
  5. use Illuminate\Database\Schema\Blueprint;
  6. use Illuminate\Database\Migrations\Migration;
  7. class CreateCourseArticlesTable extends Migration
  8. {
  9. public function up()
  10. {
  11. Schema::create('course_articles', function(Blueprint $table) {
  12. $table->increments('id');
  13. $table->string('title')->index()->comment('标题:充当目录');
  14. $table->text('body')->comment('内容');
  15. $table->integer('reply_count')->unsigned()->default(0)->comment('回复数');
  16. $table->integer('view_count')->unsigned()->default(0)->comment('查看数');
  17. $table->string('slug')->nullable()->comment('友好SEO');
  18. $table->tinyInteger('policy')->unsigned()->default(0)->comment('0:免费,1收费,2限免,注:此字段于订单无关');
  19. $table->integer('course_section_id')->unsigned()->index()->comment('教程章节 id');
  20. $table->integer('user_id')->unsigned()->index()->comment('用户 id');
  21. $table->timestamps();
  22. });
  23. }
  24. public function down()
  25. {
  26. Schema::drop('course_articles');
  27. }
  28. }