与工匠迁移的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/v141It's because you're creating it in another directory. You should run it like this:
php artisan migrate --path=database/migrations/v141更多推荐
发布评论