在我的Laravel 8项目上迁移控制器时错误

发布于 2025-02-06 12:13:49 字数 1774 浏览 1 评论 0原文

在Laravel 8课程之后,我正在从事我的大学项目。删除了权限,角色和角色和角色的表格表(我正在使用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()

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()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如梦亦如幻 2025-02-13 12:13:49
php artisan migrate:fresh

它可能有效

php artisan migrate:fresh

it may works

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文