2017_12_29_134159_create_article_table.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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->charset = 'utf8mb4';
  17. $table->collation = 'utf8mb4_unicode_ci';
  18. $table->increments('id');
  19. $table->string('title', 100)->default('')->comment('标题');
  20. $table->string('author', 50)->default('')->comment('作者');
  21. $table->text('content')->nullable()->comment('内容');
  22. $table->tinyInteger('type')->default('1')->comment('类型:1-文章、2-公告');
  23. $table->tinyInteger('is_del')->default('0')->comment('是否删除');
  24. $table->integer('sort')->default('0')->comment('排序');
  25. $table->dateTime('created_at')->nullable();
  26. $table->dateTime('updated_at')->nullable();
  27. });
  28. }
  29. /**
  30. * Reverse the migrations.
  31. *
  32. * @return void
  33. */
  34. public function down()
  35. {
  36. Schema::dropIfExists('article');
  37. }
  38. }