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

来源:互联网 发布:安卓直播app源码 编辑:程序博客网 时间:2024/06/08 11:17

php artisan migrate:refresh --seed

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

[32mNothing to rollback.

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

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

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



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

怎么做了呢?

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



0 0
原创粉丝点击