2021_08_12_220943_create_courses_table.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateCoursesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('courses', function (Blueprint $table) {
  15. $table->id();
  16. $table->integer('admin_id');
  17. $table->integer('type')->default(0)->comment('课程类型');
  18. $table->integer('category_id')->default(0)->comment('分类id');
  19. $table->string('title')->comment('课程名');
  20. $table->string('labels')->default('')->comment('标签');
  21. $table->string('slug')->comment('slug');
  22. $table->string('thumb', 500)->comment('封面');
  23. $table->string('short_description', 500)->default('')->comment('简短介绍');
  24. $table->text('description')->comment('课程介绍');
  25. $table->timestamp('published_at')->default(null)->nullable(true)->comment('上线时间');
  26. $table->tinyInteger('is_rec')->default(0)->comment('推荐,0否,1是');
  27. $table->integer('user_count')->default(0)->comment('学习人数');
  28. $table->tinyInteger('comment_status')->default(0)->comment('0关闭评论,1开启评论');
  29. $table->tinyInteger('status')->default(1)->comment('1显示,0隐藏');
  30. $table->softDeletes();
  31. $table->timestamps();
  32. });
  33. }
  34. /**
  35. * Reverse the migrations.
  36. *
  37. * @return void
  38. */
  39. public function down()
  40. {
  41. Schema::dropIfExists('courses');
  42. }
  43. }