简体   繁体   中英

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:

    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

它可能有效

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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