name = $wpdb->prefix . 'ips_cart_recovery'; $this->primary_key = 'id'; } public function get_columns() { return [ 'id' => '%d', 'session_hash' => '%s', 'email' => '%s', 'items_json' => '%s', 'currency' => '%s', 'cart_total' => '%f', 'status' => '%s', 'revision' => '%d', 'created_at' => '%d', 'capture_mode' => '%s', 'consented_at' => '%d', 'last_activity' => '%d', 'expires_at' => '%d', 'token_hash' => '%s', 'send_started_at' => '%d', 'sent_at' => '%d', 'send_error' => '%s', 'order_id' => '%d', 'recovered_at' => '%d', 'recovered_total' => '%f', ]; } public function get_indexes() { return [ 'PRIMARY', 'session_hash', 'due', 'expires_at', 'token_hash', 'order_id', 'email' ]; } public function get_install_query() { return "CREATE TABLE {$this->get_name()} ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, session_hash VARCHAR(64) NOT NULL, email VARCHAR(254) NOT NULL, items_json LONGTEXT NOT NULL, currency VARCHAR(10) NOT NULL, cart_total DECIMAL(19,4) NOT NULL DEFAULT 0, status VARCHAR(20) NOT NULL DEFAULT 'active', revision BIGINT UNSIGNED NOT NULL DEFAULT 1, created_at BIGINT UNSIGNED NOT NULL, capture_mode VARCHAR(20) NOT NULL DEFAULT 'optin', consented_at BIGINT UNSIGNED NOT NULL, last_activity BIGINT UNSIGNED NOT NULL, expires_at BIGINT UNSIGNED NOT NULL, token_hash VARCHAR(64) DEFAULT NULL, send_started_at BIGINT UNSIGNED NOT NULL DEFAULT 0, sent_at BIGINT UNSIGNED NOT NULL DEFAULT 0, send_error VARCHAR(191) NOT NULL DEFAULT '', order_id BIGINT UNSIGNED NOT NULL DEFAULT 0, recovered_at BIGINT UNSIGNED NOT NULL DEFAULT 0, recovered_total DECIMAL(19,4) NOT NULL DEFAULT 0, PRIMARY KEY (id), KEY session_hash (session_hash), KEY due (status,last_activity), KEY expires_at (expires_at), UNIQUE KEY token_hash (token_hash), KEY order_id (order_id), KEY email (email(191)) ) {$this->get_collate()};"; } }