使用迁移更改表 Laravel 5 [英] Alter table Laravel 5 with migration

查看:21
本文介绍了使用迁移更改表 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:

  1. 创建一个新的迁移文件

  1. create a new migration file

php artisan make:migration update_votes_table

  • 打开新创建的迁移文件(app_folderdatabasemigrations{date_migrationfile_was_created}-update_votes_tables.php)

  • open the newly created migration file (app_folderdatabasemigrations{date_migrationfile_was_created}-update_votes_tables.php)

    更改要更改的列

    有关详细信息,请参阅关于数据库迁移的文档

    注意:如果您将迁移文件添加到问题中,我们可以提供更详细的帮助

    Note: If you add your migrations file to the question we could provide more detailed help

    这篇关于使用迁移更改表 Laravel 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆