我试图在password_resets中进行密码恢复,但在插入电子邮件发送重置请求后,出现了一个错误,指出laravel不存在。
我已经再次尝试迁移,但都不起作用。
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "password_resets" does not exist
LINE 1: delete from "password_resets" where "email" = $1 ^ (SQL: delete from "password_resets" where "email" = blabla@gmail.com)发布于 2019-06-04 02:33:25
根据this的说法,为password_resets生成迁移的命令似乎不再存在,您可以尝试使用以下命令创建新的迁移:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('password_resets');
}
}发布于 2021-04-25 21:50:40
在我的例子中,我通过在AppServiceProvider.php中添加以下两行来修复缺少表的问题。
按照以下步骤操作:-
从类中打开AppServiceProvider.php (位置:从类外部启动此行函数app/Providers/AppServiceProvider.php).
use Illuminate\Support\Facades\Schema;
Schema::defaultStringLength(191);
php artisan migrate
php artisan migrate中的所有表
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
}
https://stackoverflow.com/questions/56432634
复制相似问题