首页 > 解决方案 > 在现有表中添加更多列,但它没有

问题描述

$ php artisan migrate

In Connection.php line 647:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
  ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr
  ement primary key, `name` varchar(191) not null, `email` varchar(191) not n
  ull, `password` varchar(191) not null, `remember_token` varchar(100) null,
  `created_at` timestamp null, `updated_at` timestamp null) default character
   set utf8mb4 collate utf8mb4_unicode_ci)


In Connection.php line 449:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
  ady exists

我正在尝试在用户表中添加更多列,但我不能。在终端我写命令 php artisan migrate 但基表或视图已经存在:1050 表'用户'已经存在。我现在能做什么?

标签: phpmysqllaravelartisan-migrate

解决方案


使用 PHP artisan migrate:refresh 它将删除所有表并再次创建所有或使用 Schema::table 添加更多列


推荐阅读