name = $wpdb->prefix . 'ips_checkout_flow_runs'; $this->primary_key = 'id'; } /** * @return array */ public function get_columns() { return [ 'id' => '%d', 'trace_id' => '%s', 'attempt_id' => '%s', 'session_key' => '%s', 'cart_hash' => '%s', 'customer_id' => '%d', 'gateway_id' => '%s', 'provider_key' => '%s', 'entry_mode' => '%s', 'flow_mode' => '%s', 'result_status' => '%s', 'failure_stage' => '%s', 'failure_reason_code' => '%s', 'failure_reason_message' => '%s', 'order_id' => '%d', 'order_key' => '%s', 'currency' => '%s', 'cart_total' => '%f', 'started_at' => '%s', 'last_event_at' => '%s', 'finished_at' => '%s', 'duration_ms' => '%d', 'meta_json' => '%s', ]; } public function get_indexes() { return [ 'PRIMARY', 'trace_id', 'result_status', 'gateway_id', 'started_at', 'last_event_at' ]; } public function get_install_query() { return "CREATE TABLE {$this->get_name()} ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, trace_id VARCHAR(64) NOT NULL, attempt_id VARCHAR(64) NOT NULL DEFAULT '', session_key VARCHAR(191) NOT NULL DEFAULT '', cart_hash VARCHAR(191) NOT NULL DEFAULT '', customer_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, gateway_id VARCHAR(100) NOT NULL DEFAULT '', provider_key VARCHAR(100) NOT NULL DEFAULT '', entry_mode VARCHAR(50) NOT NULL DEFAULT '', flow_mode VARCHAR(50) NOT NULL DEFAULT '', result_status VARCHAR(50) NOT NULL DEFAULT 'started', failure_stage VARCHAR(50) NOT NULL DEFAULT '', failure_reason_code VARCHAR(100) NOT NULL DEFAULT '', failure_reason_message VARCHAR(255) NOT NULL DEFAULT '', order_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, order_key VARCHAR(100) NOT NULL DEFAULT '', currency VARCHAR(10) NOT NULL DEFAULT '', cart_total DECIMAL(19,4) NULL DEFAULT NULL, started_at DATETIME NOT NULL, last_event_at DATETIME NOT NULL, finished_at DATETIME NULL, duration_ms BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, meta_json LONGTEXT NULL, PRIMARY KEY (id), UNIQUE KEY trace_id (trace_id), KEY result_status (result_status), KEY gateway_id (gateway_id), KEY started_at (started_at), KEY last_event_at (last_event_at) ) {$this->get_collate()};"; } }