2017-02-23 6 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

でLaravelするMariaDB JSONを追加しますので、MariaDBは、JSONデータ型の別名を持っているあなたは、データベースのGUIまたはREPLで、そのクエリを実行し、その後出て、クエリの各部分をコメントしたことがあります1行ずつ?それは、正確な問題が何であるかを明らかにするかもしれない – Spholt

答えて

3

1064はデータ型 "json"に不平を言うことに注意してください。これはMariaDBでは実装されていません(まだ)。

Dynamic Columnsで近づけることができます。少なくともJSON構文にフェッチする方法があります。

もう1つのこと(多分あなたが参照しているもの)はCONNECTで、JSON テーブルタイプを持つことができます。 (カラムタイプ)

MySQL 5.7には、JSONと呼ばれるデータ型があります。さらに、操作するための多数の関数があります。