Reputation: 21
I have this mysql:
CREATE TABLE security_user
(
id INT AUTO_INCREMENT NOT NULL,
email VARCHAR(180) NOT NULL,
roles JSON NOT NULL,
password VARCHAR(255) NOT NULL,
UNIQUE INDEX UNIQ_52825A88E7927C74 (email),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB
When I try use it in php error I have error:
1064 - Something is wrong in your syntax obok 'JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_52825A88E7927C7' in line 1
I have installed Xampp Server: https://www.apachefriends.org/pl/download.html
How can I repair this?
Upvotes: 1
Views: 56
Reputation: 31792
The current version (actually 7.1.28, 7.2.17 and 7.3.4) of XAMPP is using MariaDB 10.1.38. This version doesn't support the JSON
datatype. At least version 10.2.7 is required (see JSON Data Type).
In your case I would consider to define a clean normalized relation (user <--> role) instead of of storing the roles in a JSON array.
Upvotes: 1