基于laravel框架的antvel 在迁移数据数据出错

php artisan migrate:refresh --seed

 去使用Antvel提供的填充器将演示数据插入数据库时,出现下面的错误:

基于laravel框架的antvel 在迁移数据数据出错_第1张图片

[32mNothing to rollback.[39m

[37;41m                                                                                                                       [39;49m
[37;41m  [Illuminate\Database\QueryException]                                                                                 [39;49m
[37;41m  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that  [39;49m
[37;41m   corresponds to your MariaDB server version for the right syntax to use near 'json null, `remember_token` varchar(1  [39;49m
[37;41m  00) null, `created_at` timestamp null, `upd' at line 1 (SQL: create table `users` (`id` int unsigned not null auto_  [39;49m
[37;41m  increment primary key, `nickname` varchar(255) not null, `email` varchar(255) not null, `password` varchar(60) not   [39;49m
[37;41m  null, `pic_url` varchar(255) null, `language` varchar(255) not null default 'en', `mobile_phone` varchar(255) null,  [39;49m
[37;41m   `work_phone` varchar(255) null, `website` varchar(255) null, `twitter` varchar(255) null, `facebook` varchar(255)   [39;49m
[37;41m  null, `description` varchar(255) null, `time_zone` varchar(255) null, `rate_val` int null, `rate_count` int null, `  [39;49m
[37;41m  role` enum('admin', 'business', 'nonprofit', 'person') not null default 'person', `type` enum('normal', 'trusted')   [39;49m
[37;41m  not null default 'normal', `verified` enum('yes', 'no') not null default 'no', `preferences` json null, `remember_t  [39;49m
[37;41m  oken` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null, `disabled_at` timestamp null, `d  [39;49m
[37;41m  eleted_at` timestamp null) default character set utf8 collate utf8_unicode_ci)                                       [39;49m
[37;41m                                                                                                                       [39;49m

[37;41m                                                                                                                       [39;49m
[37;41m  [Doctrine\DBAL\Driver\PDOException]                                                                                  [39;49m
[37;41m  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that  [39;49m
[37;41m   corresponds to your MariaDB server version for the right syntax to use near 'json null, `remember_token` varchar(1  [39;49m
[37;41m  00) null, `created_at` timestamp null, `upd' at line 1                                                               [39;49m
[37;41m                                                                                                                       [39;49m

[37;41m                                                                                                                       [39;49m
[37;41m  [PDOException]                                                                                                       [39;49m
[37;41m  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that  [39;49m
[37;41m   corresponds to your MariaDB server version for the right syntax to use near 'json null, `remember_token` varchar(1  [39;49m
[37;41m  00) null, `created_at` timestamp null, `upd' at line 1                                                               [39;49m
[37;41m                                                                                                                       [39;49m



这是因为迁移文件中设置了json字段,而MySQL需要5.7以上版本才支持该字段类型,所以需要升级MySQL到5.7或者将json字段改为text字段。

怎么做了呢?

database\migrations 目录,搜索下“json” 替换成string 就可以了



你可能感兴趣的:(php框架)