有两种方式其实..首先是
php artisan migrate:rollback
然后更新您的迁移文件..重新运行
php artisan migrate
但会已经清除所有的记录之前,保存在你的数据库中..
,如果你不想用另一种方法是创建
UPDATE column属性
Schema::table('users', function (Blueprint $table) {
$table->string('name', 50)->nullable()->change();
});
重命名列
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('from', 'to');
});
删除一个新的迁移COLUMN
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['votes', 'avatar', 'location']);
});
新列
Schema::table('users', function (Blueprint $table) {
$table->string('email');
});
然后有一个捷径,但不是一个好的做法 ..更新您的迁移文件..然后手动更新数据库..
因此,我可能需要使用alter table语句进行新的迁移? – Floris
是的,你可以做到这一点,然后你就不需要回滚 – GeekSilva