laravel - PDOException::("SQLSTATE[42000]: 语法错误或访问冲突
问题描述
我正在使用 xamp、mysql 和 laravel 6 并使用 spatie 媒体库进行图像上传,我在迁移文件时遇到了问题,我的错误是
PDOException::("SQLSTATE[42000]: 语法错误或访问冲突:1064 您的 SQL 语法有错误;请查看与您的 MariaDB 服务器版本相对应的手册,了解在 'json not null,
custom_properties
json附近使用的正确语法不为空,responsive_images
第 1 行的 json 不是 n'")PDO::prepare("创建表
media
(id
int unsigned not null auto_increment 主键,model_type
varchar(191) not null,model_id
char(36) not null,collection_name
varch ar(191) not null,name
varchar(191) not null,file_name
varchar(191) not null,mime_type
varchar(191) null,disk
varchar(191) not null,size
int unsigned not null,manipulatio ns
json not null,custom_properties
json not null,responsive_images
json not null,order_column
int unsigned null,created_at
timestamp null,updated_at
timestamp null) 默认字符集 utf8mb4 collate ' utf8mb4_unicode_ci'")
我的迁移文件
Schema::create('media', function (Blueprint $table) {
$table->increments('id');
$table->string('model_type');
$table->uuid('model_id');
$table->string('collection_name');
$table->string('name');
$table->string('file_name');
$table->string('mime_type')->nullable();
$table->string('disk');
$table->unsignedInteger('size');
$table->json('manipulations');
$table->json('custom_properties');
$table->json('responsive_images');
$table->unsignedInteger('order_column')->nullable();
$table->nullableTimestamps();
解决方案
推荐阅读
- python - 如何以 16:9 的纵横比计算最接近的分辨率。蟒蛇 3
- javascript - React - 无法以编程方式从输入文本元素调度 onChange 事件
- php - 如何使 url 中的文件夹的基础转到页面
- cuda - __ddiv_ru 的语义
- php - 为什么使用ajax上传文件时页面会重新加载?
- hive - 蜂巢显示空值
- python - 为什么两次无法在python中实现共享资源(线程,计时器
- html - 表单输入没有显示在 Firefox 浏览器中?
- linux - WPF 应用程序可以在带有 .Net Core 3 的 Linux 或 Mac 中运行吗?
- python - Python ORM(和代码优先)中的模型优先方法选项