Database: Migrations Renaming Columns
發表於 : 2016-07-04 21:12:11
https://laravel.com/docs/5.2/migrations ... ng-columns
Renaming Columns
To rename a column, you may use the renameColumn method on the Schema builder. Before renaming a column, be sure to add the "doctrine/dbal" dependency to your composer.json file:
Schema::table('users', function ($table) {
$table->renameColumn('from', 'to');
});
代碼: 選擇全部
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
To rename a column, you may use the renameColumn method on the Schema builder. Before renaming a column, be sure to add the "doctrine/dbal" dependency to your composer.json file:
Schema::table('users', function ($table) {
$table->renameColumn('from', 'to');
});