与工匠迁移的laravel更新表(laravel update table with artisan migration)

编程入门 行业动态 更新时间:2024-10-26 16:30:02
工匠迁移的laravel更新表(laravel update table with artisan migration)

我只是创建一个迁移并使用命令运行迁移这里是我输入的命令和我得到的结果;

Serkan:itsp mehmet$ php artisan make:migration alter_table_rates --path="database/migrations/v141/" --table="rates" Created Migration: 2016_05_27_120219_alter_table_rates Serkan:itsp mehmet$ php artisan migrate Nothing to migrate.

这是新的迁移文件内容我只需添加新列('购买'):

public function up() { Schema::table('rates', function (Blueprint $table) { $table->integer('purchase')->nullable(); }); } public function down() { Schema::table('rates', function (Blueprint $table) { $table->dropColumn(['purchase']); }); }

你认为这会导致什么?

I simply create a migration and run migrate with commands here is the commands I type and the result I get;

Serkan:itsp mehmet$ php artisan make:migration alter_table_rates --path="database/migrations/v141/" --table="rates" Created Migration: 2016_05_27_120219_alter_table_rates Serkan:itsp mehmet$ php artisan migrate Nothing to migrate.

Here is the new migration file content I simply add new column('purchase'):

public function up() { Schema::table('rates', function (Blueprint $table) { $table->integer('purchase')->nullable(); }); } public function down() { Schema::table('rates', function (Blueprint $table) { $table->dropColumn(['purchase']); }); }

What do you think that can cause this ?

最满意答案

这是因为你在另一个目录中创建它。 你应该像这样运行它:

php artisan migrate --path=database/migrations/v141

It's because you're creating it in another directory. You should run it like this:

php artisan migrate --path=database/migrations/v141

更多推荐

本文发布于:2023-08-07 12:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464291.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工匠   laravel   update   migration   artisan

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!