[英]Laravel 4 migration
i have created my database , then i have created a table with 我创建了数据库,然后创建了一个表
php artisan migrate: make create_users_table
a file has created so i modified up and down function and i typed 文件已创建,所以我修改了上下功能并输入了
php artisan migrate
until now everything is ok the problem started when i tried to add another lignes to my database , i added another information about users and when i type 到目前为止,一切正常,当我尝试向数据库中添加另一个lignes时,问题开始了,我添加了有关用户的其他信息,以及当我键入内容时
php artisan migrate
the response was Nothing to migrate and there is no change into my databse ? 响应是什么都没有迁移,我的数据库没有变化?
3 possibilities: 3种可能性:
Create a new migration 创建一个新的迁移
Rollback the last migration operation and rerun it : 回滚上一次迁移操作并重新运行它:
php artisan migrate:rollback php artisan migrate
Rollback all migrations and run them all again 回滚所有迁移,然后再次运行它们
php artisan migrate:refresh
More info here: http://laravel.com/docs/migrations 此处提供更多信息: http : //laravel.com/docs/migrations
You have to create another migration, or you can refresh your previous migrations 您必须创建另一个迁移,或者可以刷新以前的迁移
php artisan migrate:refresh PHP的工匠迁移:刷新
http://laravel.com/docs/migrations http://laravel.com/docs/migrations
If you just added more records in a table that already exists using eg phpmyadmin, there is no need to run again php artisan migrate
, because no extra migration is created. 如果您只是使用phpmyadmin等在已经存在的表中添加了更多记录,则无需再次运行
php artisan migrate
migration,因为不会创建额外的迁移。 That's why you get the "Nothing to migrate" message. 这就是为什么您会收到“无内容迁移”消息的原因。
But, if you want for example to add a new column or delete an existing one, the ideal way to do it is by creating a new migration and name it something like add_columnname_on_users_table
, edit properly the new migration file, then run php artisan migrate
. 但是,例如,如果您要添加新列或删除现有列,则理想的方法是创建一个新的迁移,并将其命名为
add_columnname_on_users_table
类的add_columnname_on_users_table
,正确编辑新的迁移文件,然后运行php artisan migrate
migration。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.