所以我环顾四周,找到了几个如何解决这个问题的建议,但我仍然无法让它发挥作用。
所以我在我的迁移文件夹中创建了一个名为social.php的文件。
并在其中添加此代码。但是当我执行命令时
php工匠迁移
我没有什么可以作为回报迁移。
请注意,我执行此命令来创建Auth(users table
和password reset
已成功迁移),然后在我完成它们之后,我将它们备份并从迁移文件夹中删除它们。
我创建了social.php
然后所有这一切都发生了。
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSocialTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('social', function (Blueprint $table) {
$table->increments('id');
$table->string('userid');
$table->string('sname');
$table->string('sud');
$table->string('surl');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('social');
}
}
php artisan make:migration
创建了迁移文件,或者您是手动创建的?php artisan migrate
在终端中使用此命令进行迁移:
php artisan make:migration create_social_table
如果您正在寻找带迁移的模型
php artisan make:migration create_social_table -m
要创建迁移,请使用php artisan make:migration
Artisan命令:
php artisan make:migration create_tablename_table
新迁移将放在database/migrations
目录中。
之后,要运行所有未完成的迁移,请执行迁移Artisan命令:php artisan migrate
请在迁移文件夹中创建新文件夹,例如test,并将您的(social.php
)文件放在test文件夹中并在终端或cmd中运行以下命令
php artisan migrate --path=database/migrations/test/
在控制台中运行此命令:
php artisan make:migration create_tablename_table