2018_04_05_095333_create_courses_table.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateCoursesTable extends Migration
  6. {
  7. protected $table = 'courses';
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::create($this->table, function (Blueprint $table) {
  16. $table->increments('id')->comment('唯一标识')->unsigned();
  17. $table->string('name', 50)->comment('名称');
  18. $table->string('belong', 50)->comment('所属菜单id');
  19. $table->integer('user_num')->comment('可报人数')->unsigned()->nullable();
  20. $table->string('address')->comment('上课地址')->nullable();
  21. $table->text('text')->comment('介绍');
  22. $table->datetime('start_date')->comment('开始日期')->nullable();
  23. $table->datetime('end_date')->comment('结束日期')->nullable();
  24. $table->string('keywords')->comment('关键词,用于meta标签');
  25. $table->string('description')->comment('课程描述,用于meta标签');
  26. $table->string('created_admin', 25)->comment('创建的管理员账号')->nullable();
  27. $table->string('updated_admin', 25)->comment('最近修改的管理员账号')->nullable();
  28. $table->timestamps();
  29. });
  30. DB::statement("ALTER TABLE ".$this->table." comment'课程信息表'");
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. Schema::dropIfExists($this->table);
  40. }
  41. }