I M trying to migrate activity log table but it returning error as mention below
SQLSTATE[42000]: Syntax error or access
violation: 1064 You have an error in your SQL syntax; check the manual that cor
responds to your MariaDB server version for the right syntax to use near 'json n
ull, created_at timestamp null, updated_at timestamp null) default cha' at l
ine 1 (SQL: create table activity_log (id bigint unsigned not null auto_incr
ement primary key, log_name varchar(191) null, description text not null, s
ubject_id bigint unsigned null, subject_type varchar(191) null, causer_id b
igint unsigned null, causer_type varchar(191) null, properties json null, c
reated_at timestamp null, updated_at timestamp null) default character set ut
f8mb4 collate 'utf8mb4_unicode_ci')
https://mariadb.com/kb/en/library/json-data-type/
Do you use MariaB v10.2.7 or above? Otherwise the json column type doesn't exist. You could upgrade your MariaDB in this case or just switch to text column type in your migration. The json type just allows some query features inside JSON which we don't use.
@nikulnayi did you get a chance to check the version and try Gummibeer's suggestion above?
Same issue here.
@Gummibeer 's suggestion worked fine.
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
i'm trying migration, but error this below
SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table `(idbigint unsigned not null auto_increment primary key,log_namevarchar(255) null,descriptiontext not null,subject_idbigint unsigned null,subject_typevarchar(255) null,causer_idbigint unsigned null,causer_typevarchar(255) null,propertiesjson null,created_attimestamp null,updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
@ariefyudia this looks like a missing config. Have you published the config file? If so is your config possibly cached - artisan config:clear?
@ariefyudia this looks like a missing config. Have you published the config file? If so is your config possibly cached -
artisan config:clear?
solved ! thank you
I was using phpmyadmin with 10.1.38-MariaDB on shared host. In my case, updating isn't an option. So a quick workaround was to change the $table->json('properties')->nullable(); to $table->string('properties')->nullable();.
Worked for me.
you guys must have to use use TEXT instead of json in case ur not using latest spl database
and most probably Xamp doesnt support json datatype for column so use TEXT data type instead
I have this error:
[ERROR 4856: Syntax error at or near "returning" at character 162] 42601 (SQL: insert into "activity_log" ("log_name", "properties", "causer_id", "causer_type", "description", "updated_at", "created_at") values (default, [], 2, App\User, Filter Alert, 2020-09-22 12:40:29, 2020-09-22 12:40:29) returning "id")
Any idea?
Most helpful comment
https://mariadb.com/kb/en/library/json-data-type/
Do you use MariaB v10.2.7 or above? Otherwise the
jsoncolumn type doesn't exist. You could upgrade your MariaDB in this case or just switch totextcolumn type in your migration. Thejsontype just allows some query features inside JSON which we don't use.