【发布时间】:2021-06-15 13:27:05
【问题描述】:
我的数据库中有一个名为 affilaite 的表。 但是当我尝试创建一个名为 product 的新表时,它给了我一个错误 php artisan make:migration create_product_table
PHP Fatal error: Cannot declare class CreateAffiliateTable, because the name is already in use in /home/manak/Desktop/manu/Edolve/database/migrations/2021_03_09_063908_create_affiliate_table.php on line 7
Symfony\Component\ErrorHandler\Error\FatalError
Cannot declare class CreateAffiliateTable, because the name is already in use
at database/migrations/2021_03_09_063908_create_affiliate_table.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class CreateAffiliateTable extends Migration
8▕ {
9▕
10▕ Run the migrations.
11▕
Whoops\Exception\ErrorException
Cannot declare class CreateAffiliateTable, because the name is already in use
at database/migrations/2021_03_09_063908_create_affiliate_table.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class CreateAffiliateTable extends Migration
8▕ {
9▕
10▕ Run the migrations.
11▕
+1 vendor frames
2 [internal]:0
Whoops\Run::handleShutdown()
【问题讨论】:
-
同名的类已经存在。为您的迁移使用其他名称或先删除旧名称。
-
您的迁移是否已使用此类名称
CreateAffiliateTable执行?可能是您在迁移中具有相同的类名。改个名字试试,也可以给CreateAffiliateV1Table。
标签: php laravel migration laravel-artisan