通过迁移更改表Laravel 5 [英] Alter table Laravel 5 with migration
本文介绍了通过迁移更改表Laravel 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用laravel 5进行应用程序.我更改了已定义为
I'm making a application with laravel 5. I change the field 'vote ' that I have defined as
$ table-> enum ('vote', [ '- 1 ', '0 ', '1 ']);
,并且应如下所示
$ table-> enum ('vote', [' 1', ' 2', ' 3', ' 4', ' 5'] ) ;
推荐答案
为此,您应该按照以下步骤操作:
To do this you should follow these steps:
-
创建一个新的迁移文件
create a new migration file
php artisan make:migration update_votes_table
打开新创建的迁移文件(app_folder \ database \ migrations {date_migrationfile_was_created} -update_votes_tables.php)
open the newly created migration file (app_folder\database\migrations{date_migrationfile_was_created}-update_votes_tables.php)
更改要更改的列
有关更多详细信息,请参见有关数据库迁移的文档
For more details see the documentation on database migrations
注意:如果您将迁移文件添加到问题中,我们可以提供更详细的帮助
Note: If you add your migrations file to the question we could provide more detailed help
这篇关于通过迁移更改表Laravel 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文