cookieY / Yearning

🐳 A most popular sql audit platform for mysql
http://next.yearning.io/
GNU Affero General Public License v3.0
8.5k stars 1.99k forks source link

[Question] ddl 不支持 JSON 类型 #983

Closed shuqingzai closed 9 months ago

shuqingzai commented 10 months ago

描述问题 清晰而简洁地描述你遇到的问题

创建/修改带有 JSON 类型字段的数据表,无法成功

下面两个 SQL 都不能执行

-- 建表
CREATE TABLE `attribute_relations`
(
    `id`                   bigint unsigned NOT NULL COMMENT 'ID',
    `attributeIds`         json                                                                   DEFAULT NULL COMMENT '属性数据',
    `title`                varchar CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '名称',
    `createdAt`            timestamp                                                     NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updatedAt`            timestamp                                                     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deletedAt`            timestamp NULL DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='属性关联表';

-- 添加字段
ALTER TABLE `attribute_relations`
    ADD COLUMN `model` json NULL COMMENT '模型数据' AFTER `deletedAt`,

复现 重现该行为的步骤:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

期望的结果

支持JSON类型数据操作

截图

部署方式

环境 (请填写环境信息):

cookieY/Yearning: v3.1.7
MySQL: v8.0.33

额外的日志信息 在这里添加有关该问题的所有日志。

Issues-translate-bot commented 10 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: [Question] ddl does not support JSON type

cookieY commented 9 months ago

title字段应填写varchar类型长度

Issues-translate-bot commented 9 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The title field should be filled in with the varchar type length