public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('first_name',255);
$table->string('last_name',255);
$table->rememberToken();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('users');
}
如果您想添加另一个字段,比如“ status”而不需要迁移: 刷新。您可以创建另一个迁移文件,比如“ add _ status _ file _ to _ users _ table”
public function up()
{
Schema::table('users', function($table) {
$table->integer('status');
});
}
别忘了添加回滚选项:
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn('status');
});
}