Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

php artisan migrate : SQLSTATE[42000]: Syntax error or access violation #23

Closed
almohajire opened this issue Aug 9, 2018 · 5 comments
Closed

Comments

@almohajire
Copy link

c:\xampp\htdocs\laravel>php artisan migrate

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, response json null, created_at timestamp null, updated_at times' at line 1 (SQL: create table vk_requests (id int unsigned not null auto_increment primary key, user_id int null, method varchar(191) not null, request json null, response json null, created_at timestamp null, updated_at timestamp null, deleted_at timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

at C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Database\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 this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {

664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|

Exception trace:

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, response json null, created_at timestamp null, updated_at times' at line 1")
C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:452

2 PDO::prepare("create table vk_requests (id int unsigned not null auto_increment primary key, user_id int null, method varchar(191) not null, request json null, response json null, created_at timestamp null, updated_at timestamp null, deleted_at timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'")
C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:452

Please use the argument -v to see more details.

@mrhili
Copy link

mrhili commented Aug 10, 2018

Install him and then

php artisan vendor:publish

then migrate

@andrey-helldar
Copy link
Owner

What version of MariaDB are you using? The project uses the json field type in migrations. MariaDB has introduced support for this type of field since version 10.2.3.
https://mariadb.com/kb/en/library/json-functions/

@almohajire
Copy link
Author

untitledmaria

@andrey-helldar
Copy link
Owner

@almohajire MariaDB 10.1.34 version is not supported JSON field types.

This package using json field types (this and this)

JSON is fast becoming the standard format for data interchange and for unstructured data, and MariaDB 10.2 adds a range on JSON supporting functions, even though a JSON datatype isn't implemented yet. There are some reasons why there isn't a JSON datatype, but one is that there are actually not that many advantages to that as JSON is a text-based format. This blog post aims to describe JSON and the use cases for it, as well as to describe the MariaDB 10.2 JSON functions and uses for these, as well as showing some other additions to MariaDB 10.2 that are useful for JSON processing.

https://mariadb.com/resources/blog/json-mariadb-102

@almohajire
Copy link
Author

ok tnx
Update xampp from maria db 10.1 to 10.2
https://stackoverflow.com/questions/44027926/update-xampp-from-maria-db-10-1-to-10-2
now it's working

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants