簡體   English   中英

在我的 Laravel 8 項目中遷移控制器時出錯

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

我正在學習我的大學項目,學習 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