2019_03_29_223947_create_course_books_table.php 819 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * 教程 书籍表
  4. */
  5. use Illuminate\Database\Schema\Blueprint;
  6. use Illuminate\Database\Migrations\Migration;
  7. class CreateCourseBooksTable extends Migration
  8. {
  9. public function up()
  10. {
  11. Schema::create('course_books', function(Blueprint $table) {
  12. $table->increments('id');
  13. $table->string('title')->index()->comment('教程名称');
  14. $table->text('excerpt')->nullable()->comment('教程简介');
  15. $table->decimal('prices', 8, 2)->default(19.99)->comment('价格');
  16. $table->integer('user_id')->unsigned()->index()->comment('用户 id');
  17. $table->integer('image_id')->unsigned()->index()->nullable()->comment('封面图 id');
  18. $table->timestamps();
  19. });
  20. }
  21. public function down()
  22. {
  23. Schema::drop('course_books');
  24. }
  25. }