QQ扫一扫联系
在数据库迁移目录增加数据库迁移文件,内容如下
文件路径:database/migrations/2021_01_12_000000_create_blog.php
increments('id');
$table->timestamps();
$table->string('title', 200)->nullable()->comment('标题');
$table->string('cover', 200)->nullable()->comment('封面');
$table->string('summary', 200)->nullable()->comment('摘要');
$table->text('content')->nullable()->comment('内容');
});
}
public function down()
{
// 数据库回滚是比较危险的操作,推荐使用人工代替
}
}
完成,在命令行运行迁移文件脚本
php artisan migrate
执行成功会提示 Migrated: 2021_01_12_000000_create_blog