go-gorm / gorm

The fantastic ORM library for Golang, aims to be developer friendly
https://gorm.io
MIT License
36.92k stars 3.93k forks source link

add partition Error 1564 (HY000): This partition function is not allowed #7197

Open wangsiqi2015 opened 1 month ago

wangsiqi2015 commented 1 month ago

Your Question

The document you expected this should be explained

Expected answer

wangsiqi2015 commented 1 month ago

version:gorm.io/gorm v1.25.12,MySQL8.0.34

ddl:CREATE TABLE IF NOT EXISTS instance ( id bigint NOT NULL AUTO_INCREMENT, name varchar(500) NOT NULL, object_id varchar(100) NOT NULL, custom json DEFAULT NULL, extend_custom json DEFAULT ('{}'), unique_value varchar(1000) default NULL, creator varchar(100) DEFAULT NULL, modifier varchar(100) DEFAULT NULL, create_time timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', update_time timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (id,object_id) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci PARTITION BY LIST COLUMNS(object_id) (PARTITION DefaultObject VALUES IN ('DefaultObject'));

sql:alter table instance ADD PARTITION (PARTITION yyy VALUES IN ('yyy') ENGINE = InnoDB);

comment:table is ready。this sql can execute on dbeaver,but cannot be execute by gorm:Error 1564 (HY000): This partition function is not allowed image