2017_12_29_134159_create_article_table.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateArticleTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('article', function (Blueprint $table) {
  15. $table->engine = 'InnoDB';
  16. $table->increments('id');
  17. $table->string('title', 100)->default('')->comment('标题');
  18. $table->string('author', 50)->default('')->comment('作者');
  19. $table->text('content')->comment('内容')->nullable();
  20. $table->tinyInteger('is_del')->default('0')->comment('是否删除');
  21. $table->tinyInteger('type')->default('1')->comment('类型:1-文章、2-公告');
  22. $table->integer('sort')->default('0')->comment('排序');
  23. $table->dateTime('created_at')->nullable();
  24. $table->dateTime('updated_at')->nullable();
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. *
  30. * @return void
  31. */
  32. public function down()
  33. {
  34. Schema::dropIfExists('article');
  35. }
  36. }