简体   繁体   English

在我的 Laravel 8 项目中迁移控制器时出错

[英]Error while migrating controllers on my Laravel 8 project

I'm working on my project of my university following a course of Laravel 8. I have all fine but in a moment, the teacher said to write the command: php artisan migrate:fresh -seed and my tables of permissions, roles and roleHasPermissions was deleted (I'm using Spatie), I don't know why, but I'm searching to create again these tables but I'm typing php artisan migrate and now appears this error:我正在学习我的大学项目,学习 Laravel 8。我一切都很好,但一会儿,老师说要写命令: php artisan migrate:fresh -seed和我的权限表、角色表和 roleHasPermissions被删除(我正在使用 Spatie),我不知道为什么,但我正在寻找再次创建这些表,但我正在输入php artisan migrate现在出现此错误:

    Migrating: 2022_05_15_135154_create_providers_table

   Illuminate\Database\QueryException 

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'providers' already exists (SQL: create table `providers` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(255) not null, `businessName` varchar(255) not null, `rut` varchar(255) not null, `adress` varchar(255) not null, `city` varchar(255) not null, `country` varchar(255) not null, `phone` varchar(255) not null, `email` varchar(255) not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

  at C:\xampp\htdocs\crud_habibi\vendor\laravel\framework\src\Illuminate\Database\Connection.php:742
    738▕         // If an exception occurs when attempting to run a query, we'll format the error
    739▕         // message to include the bindings with SQL, which will make this exception a   
    740▕         // lot more helpful to the developer instead of just the database's errors.
    741▕         catch (Exception $e) {
  ➜ 742▕             throw new QueryException(
    743▕                 $query, $this->prepareBindings($bindings), $e
    744▕             );
    745▕         }
    746▕     }

  1   C:\xampp\htdocs\crud_habibi\vendor\laravel\framework\src\Illuminate\Database\Connection.php:527
      PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'providers' already exists")

  2   C:\xampp\htdocs\crud_habibi\vendor\laravel\framework\src\Illuminate\Database\Connection.php:527
      PDOStatement::execute()
php artisan migrate:fresh

它可能有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM