-- ----------------------------
-- Table structure for cbc_message
-- ----------------------------
-- ----------------------------
-- Table structure for cbc_message
-- ----------------------------
DROP TABLE IF EXISTS `cbc_message`;
CREATE TABLE `cbc_message` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
  `ne_type` TEXT,
  `ne_id` TEXT,
  `message_json` TEXT,
  `status` TEXT DEFAULT 'INACTIVE' CHECK(`status` IN ('ACTIVE', 'INACTIVE')),
  `detail` TEXT,
  `created_at` INTEGER DEFAULT (strftime('%s', 'now') * 1000000),
  `updated_at` INTEGER
);

-- Create indexes
CREATE INDEX `idx_id` ON `cbc_message`(`id`);
CREATE INDEX `idx_ne_time` ON `cbc_message`(`ne_type`, `ne_id`, `created_at`);
