{"table_name":"bpai_bookings","full_table_name":"wp_bpai_bookings","description":"Stores bpai bookings data created by this plugin.","detection_method":"static","confidence":"medium","create_sql":"CREATE TABLE wp_bpai_bookings ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, service_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, staff_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, customer_name VARCHAR(255) NOT NULL DEFAULT '', customer_email VARCHAR(255) NOT NULL DEFAULT '', customer_phone VARCHAR(50) NOT NULL DEFAULT '', booking_date DATE NOT NULL, start_time TIME NOT NULL, end_time TIME NOT NULL, status VARCHAR(20) NOT NULL DEFAULT 'pending', payment_status VARCHAR(20) NOT NULL DEFAULT 'unpaid', payment_method VARCHAR(50) NOT NULL DEFAULT '', total_price DECIMAL(10,2) NOT NULL DEFAULT 0.00, notes TEXT NOT NULL DEFAULT '', coupon_code VARCHAR(100) NOT NULL DEFAULT '', discount_amount DECIMAL(10,2) NOT NULL DEFAULT 0.00, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY service_id (service_id), KEY staff_id (staff_id), KEY booking_date (booking_date), KEY status (status) ) $charset_collate;\"; // Services table $sql_services = \"CREATE TABLE wp_bpai_services ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT '', description TEXT NOT NULL DEFAULT '', duration INT(11) NOT NULL DEFAULT 60, price DECIMAL(10,2) NOT NULL DEFAULT 0.00, capacity INT(11) NOT NULL DEFAULT 1, color VARCHAR(20) NOT NULL DEFAULT '#3858e9', status VARCHAR(20) NOT NULL DEFAULT 'active', created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY status (status) ) $charset_collate;\"; // Staff table $sql_staff = \"CREATE TABLE wp_bpai_staff ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, user_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, name VARCHAR(255) NOT NULL DEFAULT '', email VARCHAR(255) NOT NULL DEFAULT '', phone VARCHAR(50) NOT NULL DEFAULT '', bio TEXT NOT NULL DEFAULT '', photo VARCHAR(500) NOT NULL DEFAULT '', status VARCHAR(20) NOT NULL DEFAULT 'active', display_order INT(11) NOT NULL DEFAULT 0, PRIMARY KEY (id), KEY user_id (user_id), KEY status (status) ) $charset_collate;\"; // Staff-services pivot table $sql_staff_services = \"CREATE TABLE wp_bpai_staff_services ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, staff_id BIGINT(20) UNSIGNED NOT NULL, service_id BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (id), UNIQUE KEY staff_service (staff_id, service_id), KEY staff_id (staff_id), KEY service_id (service_id) ) $charset_collate;\"; // Staff schedules table $sql_schedules = \"CREATE TABLE wp_bpai_staff_schedules ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, staff_id BIGINT(20) UNSIGNED NOT NULL, day_of_week TINYINT(1) NOT NULL DEFAULT 0, start_time TIME NOT NULL DEFAULT '09:00:00', end_time TIME NOT NULL DEFAULT '17:00:00', is_day_off TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (id), KEY staff_id (staff_id), UNIQUE KEY staff_day (staff_id, day_of_week) ) $charset_collate;\"; // Holidays table $sql_holidays = \"CREATE TABLE wp_bpai_holidays ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, staff_id BIGINT(20) UNSIGNED DEFAULT NULL, date DATE NOT NULL, reason VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY staff_id (staff_id), KEY date (date) ) $charset_collate;\"; // Coupons table $sql_coupons = \"CREATE TABLE wp_bpai_coupons ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, code VARCHAR(100) NOT NULL DEFAULT '', discount_type VARCHAR(20) NOT NULL DEFAULT 'percent', discount_value DECIMAL(10,2) NOT NULL DEFAULT 0.00, min_amount DECIMAL(10,2) NOT NULL DEFAULT 0.00, max_uses INT(11) NOT NULL DEFAULT 0, used_count INT(11) NOT NULL DEFAULT 0, expiry_date DATE DEFAULT NULL, status VARCHAR(20) NOT NULL DEFAULT 'active', PRIMARY KEY (id), UNIQUE KEY code (code), KEY status (status) ) $charset_collate;\"; // Timeslot templates table $sql_timeslots = \"CREATE TABLE wp_bpai_timeslot_templates ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT '', days VARCHAR(255) NOT NULL DEFAULT '', start_time TIME NOT NULL DEFAULT '09:00:00', end_time TIME NOT NULL DEFAULT '17:00:00', slot_duration INT(11) NOT NULL DEFAULT 30, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) ) $charset_collate;\"; // Customers table $sql_customers = \"CREATE TABLE wp_bpai_customers ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, wp_user_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, name VARCHAR(255) NOT NULL DEFAULT '', email VARCHAR(255) NOT NULL DEFAULT '', phone VARCHAR(50) NOT NULL DEFAULT '', date_of_birth DATE DEFAULT NULL, country VARCHAR(100) NOT NULL DEFAULT '', state VARCHAR(100) NOT NULL DEFAULT '', postal_code VARCHAR(20) NOT NULL DEFAULT '', city VARCHAR(100) NOT NULL DEFAULT '', street_address VARCHAR(255) NOT NULL DEFAULT '', street_address_2 VARCHAR(255) NOT NULL DEFAULT '', street_number VARCHAR(50) NOT NULL DEFAULT '', tags VARCHAR(500) NOT NULL DEFAULT '', profile_image VARCHAR(500) NOT NULL DEFAULT '', notes TEXT NOT NULL DEFAULT '', created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY email (email), KEY wp_user_id (wp_user_id) ) $charset_collate;\"; // Categories table $sql_categories = \"CREATE TABLE wp_bpai_categories ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT '', type VARCHAR(20) NOT NULL DEFAULT 'both', color VARCHAR(20) NOT NULL DEFAULT '#6c757d', description TEXT NOT NULL DEFAULT '', created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY type (type) ) $charset_collate;\"; // Notifications table $sql_notifications = \"CREATE TABLE wp_bpai_notifications ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT '', trigger_event VARCHAR(50) NOT NULL DEFAULT 'custom', recipient VARCHAR(20) NOT NULL DEFAULT 'customer', recipients VARCHAR(100) NOT NULL DEFAULT 'customer', custom_email VARCHAR(255) NOT NULL DEFAULT '', channel VARCHAR(20) NOT NULL DEFAULT 'email', subject VARCHAR(255) NOT NULL DEFAULT '', body LONGTEXT NOT NULL, enabled TINYINT(1) NOT NULL DEFAULT 1, timing_type VARCHAR(20) NOT NULL DEFAULT 'immediate', timing_offset INT(11) NOT NULL DEFAULT 0, appointment_status VARCHAR(20) NOT NULL DEFAULT 'any', services VARCHAR(255) NOT NULL DEFAULT '', send_only TINYINT(1) NOT NULL DEFAULT 0, is_custom TINYINT(1) NOT NULL DEFAULT 0, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY trigger_event (trigger_event), KEY enabled (enabled) ) $charset_collate;\"; // Notification send-log (dedupe for scheduled notifications) $sql_notification_log = \"CREATE TABLE wp_bpai_notification_log ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, notification_id BIGINT(20) UNSIGNED NOT NULL, booking_id BIGINT(20) UNSIGNED NOT NULL, sent_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY notif_booking (notification_id, booking_id) ) $charset_collate;\"; dbDelta( $sql_bookings );","columns":[{"name":"id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":true},{"name":"service_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"staff_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"customer_name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"customer_email","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"customer_phone","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"booking_date","type":"DATE","nullable":false,"primary_key":false},{"name":"start_time","type":"TIME","nullable":false,"primary_key":false},{"name":"end_time","type":"TIME","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"payment_status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"payment_method","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"total_price","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"notes","type":"TEXT","nullable":false,"primary_key":false},{"name":"coupon_code","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"discount_amount","type":"DECIMAL(10,2)","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":false,"primary_key":false},{"name":"duration","type":"INT(11)","nullable":false,"primary_key":false},{"name":"price","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"capacity","type":"INT(11)","nullable":false,"primary_key":false},{"name":"color","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"email","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"phone","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"bio","type":"TEXT","nullable":false,"primary_key":false},{"name":"photo","type":"VARCHAR(500)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"display_order","type":"INT(11)","nullable":false,"primary_key":false},{"name":"staff_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"service_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"staff_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"day_of_week","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"start_time","type":"TIME","nullable":false,"primary_key":false},{"name":"end_time","type":"TIME","nullable":false,"primary_key":false},{"name":"is_day_off","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"staff_id","type":"BIGINT(20) UNSIGNED","nullable":true,"primary_key":false},{"name":"date","type":"DATE","nullable":false,"primary_key":false},{"name":"reason","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"code","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"discount_type","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"discount_value","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"min_amount","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"max_uses","type":"INT(11)","nullable":false,"primary_key":false},{"name":"used_count","type":"INT(11)","nullable":false,"primary_key":false},{"name":"expiry_date","type":"DATE","nullable":true,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"days","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"start_time","type":"TIME","nullable":false,"primary_key":false},{"name":"end_time","type":"TIME","nullable":false,"primary_key":false},{"name":"slot_duration","type":"INT(11)","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"wp_user_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"email","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"phone","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"date_of_birth","type":"DATE","nullable":true,"primary_key":false},{"name":"country","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"state","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"postal_code","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"city","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"street_address","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"street_address_2","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"street_number","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"tags","type":"VARCHAR(500)","nullable":false,"primary_key":false},{"name":"profile_image","type":"VARCHAR(500)","nullable":false,"primary_key":false},{"name":"notes","type":"TEXT","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"type","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"color","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"description","type":"TEXT","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"trigger_event","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"recipient","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"recipients","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"custom_email","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"channel","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"subject","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"body","type":"LONGTEXT","nullable":false,"primary_key":false},{"name":"enabled","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"timing_type","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"timing_offset","type":"INT(11)","nullable":false,"primary_key":false},{"name":"appointment_status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"services","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"send_only","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"is_custom","type":"TINYINT(1)","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"notification_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"booking_id","type":"BIGINT(20) UNSIGNED","nullable":false,"primary_key":false},{"name":"sent_at","type":"DATETIME","nullable":false,"primary_key":false}],"plugin":{"slug":"bookpilot-ai","name":"BookPilot AI","active_installs":0,"version":"1.1.3","wp_org_url":"https://wordpress.org/plugins/bookpilot-ai/"}}