{"table_name":"besked_messages","full_table_name":"wp_besked_messages","description":"Stores besked messages data created by this plugin.","detection_method":"static","confidence":"medium","create_sql":"CREATE TABLE IF NOT EXISTS wp_besked_messages ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, recipient VARCHAR(20) NOT NULL, message TEXT NOT NULL, status VARCHAR(20) NOT NULL DEFAULT 'pending', context VARCHAR(100) DEFAULT NULL, order_id BIGINT(20) UNSIGNED DEFAULT NULL, error_message TEXT DEFAULT NULL, retry_count INT(11) NOT NULL DEFAULT 0, max_retries INT(11) NOT NULL DEFAULT 5, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, sent_at DATETIME DEFAULT NULL, PRIMARY KEY (id), KEY idx_status (status), KEY idx_created_at (created_at), KEY idx_order_id (order_id) ) $charset_collate;\"; $sql_contacts = \"CREATE TABLE IF NOT EXISTS wp_besked_contacts ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, first_name VARCHAR(100) DEFAULT NULL, last_name VARCHAR(100) DEFAULT NULL, phone VARCHAR(20) NOT NULL, email VARCHAR(255) DEFAULT NULL, whatsapp_consent TINYINT(1) NOT NULL DEFAULT 0, consent_date DATETIME DEFAULT NULL, source VARCHAR(50) DEFAULT 'checkout', user_id BIGINT(20) UNSIGNED DEFAULT NULL, unsubscribe_token VARCHAR(64) DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY idx_phone (phone), UNIQUE KEY idx_unsubscribe_token (unsubscribe_token), KEY idx_consent (whatsapp_consent), KEY idx_user_id (user_id), KEY idx_email (email) ) $charset_collate;\"; $sql_abandoned_carts = \"CREATE TABLE IF NOT EXISTS wp_besked_abandoned_carts ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, session_id VARCHAR(100) NOT NULL, user_id BIGINT(20) UNSIGNED DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone VARCHAR(20) DEFAULT NULL, first_name VARCHAR(100) DEFAULT NULL, last_name VARCHAR(100) DEFAULT NULL, cart_contents LONGTEXT NOT NULL, cart_total DECIMAL(10,2) NOT NULL DEFAULT 0, currency VARCHAR(3) DEFAULT 'EUR', has_consent TINYINT(1) NOT NULL DEFAULT 0, coupon_used VARCHAR(100) DEFAULT NULL, recovery_token VARCHAR(64) NOT NULL, status VARCHAR(20) NOT NULL DEFAULT 'active', recovered_order_id BIGINT(20) UNSIGNED DEFAULT NULL, abandoned_at DATETIME DEFAULT NULL, recovered_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY idx_recovery_token (recovery_token), KEY idx_session_id (session_id), KEY idx_status (status), KEY idx_email (email), KEY idx_phone (phone), KEY idx_abandoned_at (abandoned_at), KEY idx_user_id (user_id) ) $charset_collate;\"; $sql_cart_automations = \"CREATE TABLE IF NOT EXISTS wp_besked_cart_automations ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL DEFAULT 0, trigger_delay INT(11) NOT NULL DEFAULT 60, trigger_unit VARCHAR(10) NOT NULL DEFAULT 'minutes', template TEXT NOT NULL, rules LONGTEXT DEFAULT NULL, coupon_enabled TINYINT(1) NOT NULL DEFAULT 0, coupon_type VARCHAR(20) DEFAULT 'percent', coupon_amount DECIMAL(10,2) DEFAULT 0, coupon_validity_hours INT(11) DEFAULT 72, coupon_auto_apply TINYINT(1) NOT NULL DEFAULT 0, priority INT(11) NOT NULL DEFAULT 0, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_enabled (enabled), KEY idx_priority (priority) ) $charset_collate;\"; $sql_lists = \"CREATE TABLE IF NOT EXISTS wp_besked_lists ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) ) $charset_collate;\"; $sql_contact_lists = \"CREATE TABLE IF NOT EXISTS wp_besked_contact_lists ( contact_id BIGINT(20) UNSIGNED NOT NULL, list_id BIGINT(20) UNSIGNED NOT NULL, added_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (contact_id, list_id), KEY idx_list_id (list_id) ) $charset_collate;\"; $sql_cart_automation_logs = \"CREATE TABLE IF NOT EXISTS wp_besked_cart_automation_logs ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, automation_id BIGINT(20) UNSIGNED NOT NULL, cart_id BIGINT(20) UNSIGNED NOT NULL, message_id BIGINT(20) UNSIGNED DEFAULT NULL, coupon_code VARCHAR(100) DEFAULT NULL, coupon_expires_at DATETIME DEFAULT NULL, status VARCHAR(20) NOT NULL DEFAULT 'scheduled', scheduled_at DATETIME NOT NULL, sent_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_status_scheduled (status, scheduled_at), KEY idx_cart_id (cart_id), KEY idx_automation_id (automation_id) ) $charset_collate;\"; $sql_campaigns = \"CREATE TABLE IF NOT EXISTS wp_besked_campaigns ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT '', message TEXT NOT NULL, list_ids TEXT NOT NULL DEFAULT '[]', scheduled_at DATETIME NULL DEFAULT NULL, status VARCHAR(20) NOT NULL DEFAULT 'draft', sent_count INT(11) UNSIGNED NOT NULL DEFAULT 0, failed_count INT(11) UNSIGNED NOT NULL DEFAULT 0, attachment_id BIGINT(20) UNSIGNED NULL DEFAULT NULL, media_url VARCHAR(500) NULL DEFAULT NULL, media_type VARCHAR(20) NULL DEFAULT NULL, media_filename VARCHAR(255) NULL DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_status (status), KEY idx_scheduled_at (scheduled_at) ) $charset_collate;\"; $sql_campaign_logs = \"CREATE TABLE IF NOT EXISTS wp_besked_campaign_logs ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, campaign_id BIGINT(20) UNSIGNED NOT NULL, contact_id BIGINT(20) UNSIGNED NOT NULL, phone VARCHAR(20) NOT NULL, status VARCHAR(20) NOT NULL DEFAULT 'pending', error_message TEXT DEFAULT NULL, sent_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_campaign_id (campaign_id), KEY idx_status (status) ) $charset_collate;\"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta( $sql_messages );","columns":[{"name":"id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":true},{"name":"recipient","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"message","type":"TEXT","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"context","type":"VARCHAR(100)","nullable":true,"primary_key":false},{"name":"order_id","type":"BIGINT(20) UNSIGNED","nullable":true,"primary_key":false},{"name":"error_message","type":"TEXT","nullable":true,"primary_key":false},{"name":"retry_count","type":"INT(11)","nullable":false,"primary_key":false},{"name":"max_retries","type":"INT(11)","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"sent_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"first_name","type":"VARCHAR(100)","nullable":true,"primary_key":false},{"name":"last_name","type":"VARCHAR(100)","nullable":true,"primary_key":false},{"name":"phone","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"email","type":"VARCHAR(255)","nullable":true,"primary_key":false},{"name":"whatsapp_consent","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"consent_date","type":"DATETIME","nullable":true,"primary_key":false},{"name":"source","type":"VARCHAR(50)","nullable":true,"primary_key":false},{"name":"user_id","type":"BIGINT(20) UNSIGNED","nullable":true,"primary_key":false},{"name":"unsubscribe_token","type":"VARCHAR(64)","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"updated_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"session_id","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT(20) UNSIGNED","nullable":true,"primary_key":false},{"name":"email","type":"VARCHAR(255)","nullable":true,"primary_key":false},{"name":"phone","type":"VARCHAR(20)","nullable":true,"primary_key":false},{"name":"first_name","type":"VARCHAR(100)","nullable":true,"primary_key":false},{"name":"last_name","type":"VARCHAR(100)","nullable":true,"primary_key":false},{"name":"cart_contents","type":"LONGTEXT","nullable":false,"primary_key":false},{"name":"cart_total","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"currency","type":"VARCHAR(3)","nullable":true,"primary_key":false},{"name":"has_consent","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"coupon_used","type":"VARCHAR(100)","nullable":true,"primary_key":false},{"name":"recovery_token","type":"VARCHAR(64)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"recovered_order_id","type":"BIGINT(20) UNSIGNED","nullable":true,"primary_key":false},{"name":"abandoned_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"recovered_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"updated_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"enabled","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"trigger_delay","type":"INT(11)","nullable":false,"primary_key":false},{"name":"trigger_unit","type":"VARCHAR(10)","nullable":false,"primary_key":false},{"name":"template","type":"TEXT","nullable":false,"primary_key":false},{"name":"rules","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"coupon_enabled","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"coupon_type","type":"VARCHAR(20)","nullable":true,"primary_key":false},{"name":"coupon_amount","type":"DECIMAL(10,2)","nullable":true,"primary_key":false},{"name":"coupon_validity_hours","type":"INT(11)","nullable":true,"primary_key":false},{"name":"coupon_auto_apply","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"priority","type":"INT(11)","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"updated_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"description","type":"TEXT","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"list_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"added_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"automation_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"cart_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"message_id","type":"BIGINT(20) UNSIGNED","nullable":true,"primary_key":false},{"name":"coupon_code","type":"VARCHAR(100)","nullable":true,"primary_key":false},{"name":"coupon_expires_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"scheduled_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"sent_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"message","type":"TEXT","nullable":false,"primary_key":false},{"name":"list_ids","type":"TEXT","nullable":false,"primary_key":false},{"name":"scheduled_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"sent_count","type":"INT(11) UNSIGNED","nullable":false,"primary_key":false},{"name":"failed_count","type":"INT(11) UNSIGNED","nullable":false,"primary_key":false},{"name":"attachment_id","type":"BIGINT(20) UNSIGNED","nullable":true,"primary_key":false},{"name":"media_url","type":"VARCHAR(500)","nullable":true,"primary_key":false},{"name":"media_type","type":"VARCHAR(20)","nullable":true,"primary_key":false},{"name":"media_filename","type":"VARCHAR(255)","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"updated_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"campaign_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"contact_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"phone","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"error_message","type":"TEXT","nullable":true,"primary_key":false},{"name":"sent_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false}],"plugin":{"slug":"besked-wa-notifications","name":"Besked Notifications","active_installs":0,"version":"1.5.4","wp_org_url":"https://wordpress.org/plugins/besked-wa-notifications/"}}