
org.killbill.queue.bus_events_mysql.sql Maven / Gradle / Ivy
CREATE TABLE IF NOT EXISTS ${tableName} (
record_id serial unique,
class_name varchar(128) NOT NULL,
event_json varchar(2048) NOT NULL,
user_token varchar(36),
created_date datetime NOT NULL,
creating_owner varchar(50) NOT NULL,
processing_owner varchar(50) DEFAULT NULL,
processing_available_date datetime DEFAULT NULL,
processing_state varchar(14) DEFAULT 'AVAILABLE',
error_count int /*! unsigned */ DEFAULT 0,
search_key1 bigint /*! unsigned */ default null,
search_key2 bigint /*! unsigned */ default null,
PRIMARY KEY(record_id)
) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
CREATE INDEX idx_bus_where ON ${tableName}(processing_state, processing_owner, processing_available_date);
CREATE INDEX bus_events_tenant_account_record_id ON ${tableName}(search_key2, search_key1);
CREATE TABLE IF NOT EXISTS ${historyTableName} (
record_id serial unique,
class_name varchar(128) NOT NULL,
event_json varchar(2048) NOT NULL,
user_token varchar(36),
created_date datetime NOT NULL,
creating_owner varchar(50) NOT NULL,
processing_owner varchar(50) DEFAULT NULL,
processing_available_date datetime DEFAULT NULL,
processing_state varchar(14) DEFAULT 'AVAILABLE',
error_count int /*! unsigned */ DEFAULT 0,
search_key1 bigint /*! unsigned */ default null,
search_key2 bigint /*! unsigned */ default null,
PRIMARY KEY(record_id)
) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
CREATE INDEX bus_events_history_tenant_account_record_id ON ${historyTableName}(search_key2, search_key1);
CREATE TABLE IF NOT EXISTS ${tableName}_log (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_token` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '事务id',
`processing_owner` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`processing_state` varchar(14) COLLATE utf8mb4_general_ci NOT NULL COMMENT '处理状态',
`message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '错误信息',
`created_date` datetime DEFAULT NULL COMMENT '创建时间',
`updated_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_user_token` (`user_token`)
) /*! CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci */;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy