gpt4 book ai didi

laravel - SQLSTATE[42S01] : Base table or view already exists: 1050 Why I can not drop the table

转载 作者:行者123 更新时间:2023-12-02 16:55:20 28 4
gpt4 key购买 nike

在 Connection.php 第 664 行:

SQLSTATE[42S01]:基表或 View 已存在:1050 表 'credit_prop_fees' 已存在(SQL:创建表credit_prop_fees(idint unsigned not null auto_increment 主键,fee_idint not null,created_at时间戳为空,updated_at 时间戳 null) 默认字符集 utf8mb4 collat​​e utf8mb4_unicode_ci)

我有两个迁移,一个接一个这是第一个

public function up()
{
Schema::create('credit_prop_fees', function (Blueprint $table) {
$table->increments('id');
$table->integer('fee_id');


$table->timestamps();
});
}

正如您在下一次迁移中看到的,我有 dropeIfExist() 函数

public function up()
{
Schema::dropIfExists('credit_prop_fees');

Schema::create('credit_prop_fees', function (Blueprint $table) {
$table->increments('id');
$table->integer('credit_id');
$table->integer('credit_prop_id');
$table->integer('fee_type_id');
$table->integer('fee_value_id');
$table->timestamps();
});
}

我正在尝试让 php artisan 迁移如果我编写 Schema::dropIfExists('credit_prop_fees'); 为什么会收到此错误

即使当我使用tinker时,我也有null,但表已被删除C:\OSPanel\domains\laravel.bai.loc>php artisantinkerPsy Shell v0.8.17(PHP 7.1.12 — cli),作者:Justin Hileman

Schema::drop('credit_prop_fees'); => null

感谢您的回答

最佳答案

我不知道你为什么要删除新创建的表,但请尝试:

php arisan migrate:fresh

关于laravel - SQLSTATE[42S01] : Base table or view already exists: 1050 Why I can not drop the table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48230799/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com