weixin_48914063 2021-12-13 12:11 采纳率: 25%
浏览 12
已结题

初始化数据库报错,求解

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

D:\myphp_www\PHPTutorial\WWW\web>php artisan migrate:refresh --seed
PHP Fatal error: Cannot declare class CreateUserAddressesTable, because the name is already in use in D:\myphp_www\PHPTutorial\WWW\web\database\migrations\2021_11_23_015703_create_user_addresses_table.php on line 37

Symfony\Component\Debug\Exception\FatalErrorException : Cannot declare class CreateUserAddressesTable, because the name is already in use

at D:\myphp_www\PHPTutorial\WWW\web\database\migrations\2021_11_23_015703_create_user_addresses_table.php:37
33| public function down()
34| {
35| Schema::dropIfExists('user_addresses');
36| }

37| }
38|

Whoops\Exception\ErrorException : Cannot declare class CreateUserAddressesTable, because the name is already in use

at D:\myphp_www\PHPTutorial\WWW\web\database\migrations\2021_11_23_015703_create_user_addresses_table.php:37
33| public function down()
34| {
35| Schema::dropIfExists('user_addresses');
36| }

37| }
38|

Exception trace:

1 Whoops\Run::handleError("Cannot declare class CreateUserAddressesTable, because the name is already in use", "D:\myphp_www\PHPTutorial\WWW\web\database\migrations\2021_11_23_015703_create_user_addresses_table.php")
D:\myphp_www\PHPTutorial\WWW\web\vendor\filp\whoops\src\Whoops\Run.php:454

2 Whoops\Run::handleShutdown()
[internal]:0

img

  • 写回答

1条回答 默认 最新

  • 明日晴空 2021-12-13 16:31
    关注

    表名重复啦,看一下其他文件,是不是也创建了user_addresses_table

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 12月21日
  • 已采纳回答 12月13日
  • 创建了问题 12月13日