-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: recognize json_valid
constraint as json field type for database mariadb #2746
#3309
Conversation
@gqcn First, please upload |
MariaDB 中json字段存的就是 |
The json field in MariaDB stores the |
MariaDB 存 json 字段的确时 |
MariaDB does store json fields as |
CREATE TABLE locations (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
type CHAR(1) NOT NULL,
latitude DECIMAL(9,6) NOT NULL,
longitude DECIMAL(9,6) NOT NULL,
attr LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
CHECK (JSON_VALID(`attr`)
PRIMARY KEY (id)
); 请注意, attr 列的数据类型是 LONGTEXT 。除此之外,您会发现字符集和排序规则字段中添加了一些约束。然而,最重要的是 CHECK 约束,它指示当 attr 中的数据通过插入或更新进行修改时将执行的函数。 |
CREATE TABLE locations (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
type CHAR(1) NOT NULL,
latitude DECIMAL(9,6) NOT NULL,
longitude DECIMAL(9,6) NOT NULL,
attr LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
CHECK (JSON_VALID(`attr`)
PRIMARY KEY (id)
); Note that the data type of the attr column is LONGTEXT . In addition to this, you'll find some constraints added to the character set and collation fields. The most important, however, is the CHECK constraint, which indicates the function that will be executed when the data in attr is modified by insert or update. |
json_valid
constraint as json field type for database mariadb #2746
fixed #2746
Dear reviewer:
修复 mariaDb
gf gen dao
的json
字段识别为string
问题实现说明
在
mysql driver
中增加对mariaDb
的识别,如果是,则使用 mariaDb 特有的json
字段类型的判断方式,用以和mysql json
做出区分