laravel 5.8 迁移基础 table 或视图已经存在无需删除 table
laravel 5.8 migration Base table or view already exist no need to drop table
我正尝试在 laravel 5.8 上使用迁移,但收到此错误消息
C:\wamp\www\work_p\laravel\lvl1>php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view alr
eady exists: 1050 Table 'users' already exists (SQL: create table `users` (`id`
bigint unsigned not null auto_increment primary key, `name` varchar(191) not nul
l, `email` varchar(191) not null, `email_verified_at` timestamp null, `password`
varchar(191) not null, `remember_token` varchar(100) null, `created_at` timesta
mp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf
8mb4_unicode_ci')
at C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Dat
abase\Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll
format the error
661| // message to include the bindings with SQL, which will make th
is exception a
662| // lot more helpful to the developer instead of just the databa
se's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 T
able 'users' already exists")
C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Da
tabase\Connection.php:458
2 PDOStatement::execute()
C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Da
tabase\Connection.php:458
Please use the argument -v to see more details.
我在这里找到的所有解决方案都说我必须删除 tables;
但是我不能在我的 table 上有数据 我有我的用户 table 和所有其他 table 上的数据。有没有 drop tables 解决这个错误的方法?
我确实尝试过使用这个解决方案
public function boot()
{
Schema::defaultStringLength(191);
}
问题依然存在
如果您不想运行具体迁移,运行您的数据库上的这个查询
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (NULL, '2014_10_12_000000_create_users_table', '1');
我正尝试在 laravel 5.8 上使用迁移,但收到此错误消息
C:\wamp\www\work_p\laravel\lvl1>php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view alr
eady exists: 1050 Table 'users' already exists (SQL: create table `users` (`id`
bigint unsigned not null auto_increment primary key, `name` varchar(191) not nul
l, `email` varchar(191) not null, `email_verified_at` timestamp null, `password`
varchar(191) not null, `remember_token` varchar(100) null, `created_at` timesta
mp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf
8mb4_unicode_ci')
at C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Dat
abase\Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll
format the error
661| // message to include the bindings with SQL, which will make th
is exception a
662| // lot more helpful to the developer instead of just the databa
se's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 T
able 'users' already exists")
C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Da
tabase\Connection.php:458
2 PDOStatement::execute()
C:\wamp\www\work_p\laravel\lvl1\vendor\laravel\framework\src\Illuminate\Da
tabase\Connection.php:458
Please use the argument -v to see more details.
我在这里找到的所有解决方案都说我必须删除 tables;
但是我不能在我的 table 上有数据 我有我的用户 table 和所有其他 table 上的数据。有没有 drop tables 解决这个错误的方法? 我确实尝试过使用这个解决方案
public function boot()
{
Schema::defaultStringLength(191);
}
问题依然存在
如果您不想运行具体迁移,运行您的数据库上的这个查询
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (NULL, '2014_10_12_000000_create_users_table', '1');