Laravel 5.4特定表迁移 [英] Laravel 5.4 Specific Table Migration
本文介绍了Laravel 5.4特定表迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,请阅读 https://laravel.com/docs/5.4/migrations .
有没有一种方法来迁移特定的迁移文件(仅1个迁移),每当我使用php artisan migrate:refresh
进行更改并且所有字段都被重置时,立即导致这种情况.
Is there a way on how to migrate a certain migration file (1 migration only), cause right now every time there is a change I use php artisan migrate:refresh
and all fields are getting reset.
推荐答案
首先,您应该为表创建一个migration
文件,例如:
First you should create one migration
file for your table like:
public function up()
{
Schema::create('test', function (Blueprint $table) {
$table->increments('id');
$table->string('fname',255);
$table->string('lname',255);
$table->rememberToken();
$table->timestamps();
});
}
在 migrations 文件夹中创建 test 文件夹后,将新创建的 migration 移至/复制到 test 文件夹中并运行您的终端/cmd 中的以下命令,例如:
After create test folder in migrations folder then newly created migration moved/copied in test folder and run below command in your terminal/cmd like:
php artisan migrate --path=/database/migrations/test/
这篇关于Laravel 5.4特定表迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文