我的数据库中有一个名为 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()
答案 0 :(得分:0)
从这个错误我认为你已经有一个名为 DocumentsContract.BuildDocumentUriUsingTree
的迁移。
请更改您的迁移名称或删除旧迁移
答案 1 :(得分:0)
检查您的数据库/迁移文件夹。如果文件已经存在,则将其删除。此外,如果已经有一个名称完全相同的表,则从数据库中删除该表。在数据库中还有一个迁移表。也从那里删除表名,然后再次尝试迁移。 根据 Laravel 约定,迁移是复数,模型名称是单数。所以最好尝试 CreateAffiliatesTable 而不是 CreateAffiliateTable
答案 2 :(得分:0)
使用此命令创建 $ php artisan make:migration create_products_table