【问题标题】:php artisan migrate command migrate errorphp artisan migrate 命令迁移错误
【发布时间】:2017-09-27 17:14:25
【问题描述】:

当我运行 php artisan 迁移时。它将显示以下错误:

[Illuminate\Database\QueryException]
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'translations' already exists (SQL: create table `translations` (`
  id` int unsigned not null auto_increment primary key, `table_name` varchar(191) not null, `column_name` varchar(191) not null, `f
  oreign_key` int unsigned not null, `locale` varchar(191) not null, `value` text not null, `created_at` timestamp null, `updated_a
  t` timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)



  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'translations' already exists



  [PDOException]
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'translations' already exists

在此之前我运行了 php artisan make:auth 命令,之后我安装了 voyager laravel 管理面板,之后我运行了 migrate 命令。

我不知道表格有什么问题。

【问题讨论】:

  • 您在迁移过程中似乎不止一次运行Schema:: create。如果要更改现有表,请使用 Schema::table

标签: php laravel laravel-5.3 laravel-artisan artisan-migrate


【解决方案1】:
php artisan migrate:refresh 

试试这个(如果不起作用,你需要徒手清除数据库,只需删除表并再次尝试 php artisan migrate 祝你好运

【讨论】:

    猜你喜欢
    • 2019-10-29
    • 2021-08-21
    • 2018-06-07
    • 2017-06-01
    • 2020-06-20
    • 2020-03-21
    • 2020-10-23
    • 2017-05-31
    • 1970-01-01
    相关资源
    最近更新 更多