2018_04_02_153109_create_articles_table.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. protected $table = 'articles';
  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('title', 50)->comment('标题');
  18. $table->string('belong', 50)->comment('所属菜单id');
  19. $table->string('txt')->comment('简介');
  20. $table->text('text')->comment('html内容');
  21. $table->string('cover')->comment('封面');
  22. $table->string('keywords')->comment('关键词,用于meta标签');
  23. $table->string('created_admin', 25)->comment('创建的管理员账号')->nullable();
  24. $table->string('updated_admin', 25)->comment('最近修改的管理员账号')->nullable();
  25. $table->timestamps();
  26. });
  27. DB::statement("ALTER TABLE ".$this->table." comment'文章信息表'");
  28. }
  29. /**
  30. * Reverse the migrations.
  31. *
  32. * @return void
  33. */
  34. public function down()
  35. {
  36. Schema::dropIfExists($this->table);
  37. }
  38. }