I have a problem i don’t realy know how to fix,
CREATE TABLE `user` ( `id` int(11) NOT NULL, `email` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL, `roles` json NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci MySQL a répondu : Documentation #1064 - Erreur de syntaxe près de 'json NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL )' à la ligne 4
I took this sql when i exported my database in localhost, but when i try to create the User Table for my site in Production i get this Error message.
I thought it was because je ‘Json’ format for the ‘role’ but when i change it to ‘array’ i still get the same error.
Advertisement
Answer
Check your mysql version. Based on mysql site documentation, it say:
Prior to MySQL 8.0.13, a JSON column cannot have a non-NULL default value.
reference: https://dev.mysql.com/doc/refman/8.0/en/json.html