2017-02-23 1 views
3

phpmyAdmin을 사용하여 XAMP에서 json 데이터베이스를 만들려고하고 있는데 mariaDB를 사용하고있는 것으로 나타 났지만 xamp-control panel v3.2.2에서는 mySQL on port 3306이 표시됩니다. 심지어mariaDB Laravel의 JSON 지원

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, content json null, scripts json null, deleted_at timestamp null' at line 1 (SQL: create table pages (id int unsigned not null auto_increment primary key, title varchar(191) not null, slug varchar(191) not null, styles json null, content json null, scripts json null, deleted_at timestamp null, created_at timestamp null, updated_at timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)

: 나는 다음과 같은 오류가있어이를 실행하는 동안 이제

Schema::connection('newPortal')->create('pages', function (Blueprint $table){ 
    $table->increments('id'); 
    $table->string('title'); 
    $table->string('slug')->unique()->index(); 
    $table->json('styles')->nullable(); 
    $table->json('content')->nullable(); 
    $table->json('scripts')->nullable(); 
    $table->softDeletes(); 
    $table->timestamps(); 
}); 

을 : 나는 다음과 같은 데이터베이스를 만들 Laravel 5.4 프레임 워크를 사용하고있어 내가 실행하기 위해 노력하고있어 내 마이그레이션입니다 null이 아니면 같은 오류가 발생합니다. json 형식의 데이터를 갖고 싶습니다. 지원되는 버전을 확인하고 json 형식 지원을 버전 MariaDB 10.0.16.에서 시작하여 사용하고 있습니다. 10.1.21-MariaDB

도와주세요.

+0

당신이 데이터베이스 GUI 또는 REPL에서 해당 쿼리를 실행 한 후 밖으로 쿼리의 각 부분을 주석 시도 가지고 JSON 데이터 타입에 대한 별칭이 한 줄씩? 정확한 문제가 무엇인지 밝힐 수 있습니다. – Spholt

답변

3

1064가 "json"데이터 유형에 대해 불평했습니다. MariaDB에서는 아직 구현되지 않았습니다.

Dynamic Columns으로 끝낼 수 있습니다. 적어도 JSON 구문으로 페치 할 수있는 방법이 있습니다.

또 다른 것 (아마도 당신이 말하는 것)은 CONNECT이 테이블 유형 인 JSON 을 가질 수 있습니다. ( 유형)

MySQL 5.7에는 JSON이라는 데이터 유형이 있으며, 조작하기위한 여러 기능이 있습니다. 버전 10.2.7

는 MariaDB JSON과 함께 Laravel에 추가하기 때문에