CREATE TABLE IF NOT EXISTS tax_queue (
    id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    ref_no VARCHAR(64) NOT NULL,
    queue_name VARCHAR(64) NOT NULL,
    payload_json MEDIUMTEXT NOT NULL,
    attempt_no INT NOT NULL DEFAULT 0,
    execute_after DATETIME NOT NULL,
    status ENUM('Pending', 'Processing', 'Done', 'Failed') NOT NULL DEFAULT 'Pending',
    created_at DATETIME NOT NULL,
    updated_at DATETIME NOT NULL,
    PRIMARY KEY (id),
    KEY idx_tax_queue_ref_no (ref_no),
    KEY idx_tax_queue_execute_status (execute_after, status),
    KEY idx_tax_queue_name (queue_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

