Files
canal/parse/src/main/resources/ddl/h2/meta_history.sql
jianghang.loujh 69a06dba09 fixed issue #5517: H2 database field type error causing 'Value too long for column' exception
- Changed meta_snapshot.data from longtext to CLOB in H2 schema
- Changed meta_history.sql_text from longtext to CLOB in H2 schema
- H2 database doesn't recognize MySQL's longtext type and converts it to VARCHAR with length limit
- CLOB type supports up to 2GB text data, solving the issue when storing large table structures (>1MB DDL)
2026-02-12 17:42:44 +08:00

21 lines
1.3 KiB
SQL

CREATE TABLE IF NOT EXISTS `meta_history` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`gmt_create` datetime NOT NULL COMMENT '创建时间',
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
`destination` varchar(128) DEFAULT NULL COMMENT '通道名称',
`binlog_file` varchar(64) DEFAULT NULL COMMENT 'binlog文件名',
`binlog_offest` bigint(20) DEFAULT NULL COMMENT 'binlog偏移量',
`binlog_master_id` varchar(64) DEFAULT NULL COMMENT 'binlog节点id',
`binlog_timestamp` bigint(20) DEFAULT NULL COMMENT 'binlog应用的时间戳',
`use_schema` varchar(1024) DEFAULT NULL COMMENT '执行sql时对应的schema',
`sql_schema` varchar(1024) DEFAULT NULL COMMENT '对应的schema',
`sql_table` varchar(1024) DEFAULT NULL COMMENT '对应的table',
`sql_text` CLOB DEFAULT NULL COMMENT '执行的sql',
`sql_type` varchar(256) DEFAULT NULL COMMENT 'sql类型',
`extra` text DEFAULT NULL COMMENT '额外的扩展信息',
PRIMARY KEY (`id`),
UNIQUE KEY meta_history_binlog_file_offest(`destination`,`binlog_master_id`,`binlog_file`,`binlog_offest`),
KEY `meta_history_destination` (`destination`),
KEY `meta_history_destination_timestamp` (`destination`,`binlog_timestamp`),
KEY `meta_history_gmt_modified` (`gmt_modified`)
);