{"slug":"codeatoz-b2b-suite-for-woocommerce","name":"CodeAtoZ B2B Suite for WooCommerce","description":"B2B commerce tools for WooCommerce — wholesale pricing, RFQ, registration approvals, analytics, and email automation.","author":"codeatoz","active_installs":0,"version":"1.1.1","wp_org_url":"https://wordpress.org/plugins/codeatoz-b2b-suite-for-woocommerce/","is_closed":false,"cleanup":{"has_uninstall_hook":true,"drops_tables_on_uninstall":true,"deletes_options_on_uninstall":false},"tables":[{"table_name":"b2b_analytics_events","full_table_name":"wp_b2b_analytics_events","description":"Stores analytics or statistics data.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_automation_logs","full_table_name":"wp_b2b_automation_logs","description":"A logging table that records activity, events, or audit history.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_companies","full_table_name":"wp_b2b_companies","description":"Stores b2b companies data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_company_members","full_table_name":"wp_b2b_company_members","description":"Stores b2b company members data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_credit_accounts","full_table_name":"wp_b2b_credit_accounts","description":"Stores b2b credit accounts data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_invoices","full_table_name":"wp_b2b_invoices","description":"Stores b2b invoices data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_leads","full_table_name":"wp_b2b_leads","description":"Stores b2b leads data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_notifications","full_table_name":"wp_b2b_notifications","description":"Stores b2b notifications data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_price_book_assignments","full_table_name":"wp_b2b_price_book_assignments","description":"Stores b2b price book assignments data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_price_book_items","full_table_name":"wp_b2b_price_book_items","description":"Stores b2b price book items data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_price_books","full_table_name":"wp_b2b_price_books","description":"Stores b2b price books data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_pricing_rules","full_table_name":"wp_b2b_pricing_rules","description":"Stores b2b pricing rules data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_quote_items","full_table_name":"wp_b2b_quote_items","description":"Stores b2b quote items data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_quote_notes","full_table_name":"wp_b2b_quote_notes","description":"Stores b2b quote notes data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_quotes","full_table_name":"wp_b2b_quotes","description":"Stores b2b quotes data created by this plugin.","detection_method":"static","confidence":"medium","columns":[{"name":"id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":true},{"name":"quote_number","type":"VARCHAR(32)","nullable":false,"primary_key":false},{"name":"customer_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"customer_name","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"customer_email","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"subtotal","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"discount","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"total","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"currency","type":"VARCHAR(10)","nullable":false,"primary_key":false},{"name":"note_customer","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"note_admin","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"expires_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"converted_order_id","type":"BIGINT UNSIGNED","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":"quote_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"product_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"variation_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"sku","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"quantity","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"unit_price","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"line_total","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"meta_data","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"quote_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"author_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"type","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"content","type":"LONGTEXT","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"rule_type","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"role","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"product_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"category_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"min_qty","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"max_qty","type":"DECIMAL(10,2)","nullable":false,"primary_key":false},{"name":"discount_type","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"discount_value","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"fixed_price","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"priority","type":"INT","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"company_name","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"vat_number","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"phone","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"country","type":"VARCHAR(10)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"notes","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"documents","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"reviewed_by","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"reviewed_at","type":"DATETIME","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"type","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"email","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"phone","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"product_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"message","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"source","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"utm_source","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"utm_medium","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"utm_campaign","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"assigned_to","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"crm_contact_id","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"meta","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"label","type":"VARCHAR(200)","nullable":false,"primary_key":false},{"name":"cart_data","type":"LONGTEXT","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":"rule_key","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"object_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"object_type","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"meta","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"event_type","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"object_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"object_type","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"value","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"meta","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"rep_user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"customer_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"team","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"commission","type":"DECIMAL(5,2)","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"type","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"title","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"message","type":"LONGTEXT","nullable":false,"primary_key":false},{"name":"link","type":"VARCHAR(500)","nullable":false,"primary_key":false},{"name":"read_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":"start_date","type":"DATE","nullable":true,"primary_key":false},{"name":"end_date","type":"DATE","nullable":true,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"priority","type":"INT","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"price_book_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"item_type","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"object_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"price_type","type":"VARCHAR(30)","nullable":false,"primary_key":false},{"name":"value","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"price_book_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"company_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"credit_limit","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"balance_used","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"terms","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":"updated_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"name","type":"VARCHAR(255)","nullable":false,"primary_key":false},{"name":"admin_user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"vat_number","type":"VARCHAR(100)","nullable":false,"primary_key":false},{"name":"credit_limit","type":"DECIMAL(20,6)","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":"company_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"member_role","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"joined_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"rule_type","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"object_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"roles","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"companies","type":"LONGTEXT","nullable":true,"primary_key":false},{"name":"action","type":"VARCHAR(10)","nullable":false,"primary_key":false},{"name":"priority","type":"INT","nullable":false,"primary_key":false},{"name":"created_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"order_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"invoice_number","type":"VARCHAR(50)","nullable":false,"primary_key":false},{"name":"user_id","type":"BIGINT UNSIGNED","nullable":false,"primary_key":false},{"name":"total","type":"DECIMAL(20,6)","nullable":false,"primary_key":false},{"name":"status","type":"VARCHAR(20)","nullable":false,"primary_key":false},{"name":"issued_at","type":"DATETIME","nullable":false,"primary_key":false},{"name":"due_at","type":"DATETIME","nullable":true,"primary_key":false}],"create_sql":"CREATE TABLE wp_b2b_quotes ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, quote_number VARCHAR(32) NOT NULL UNIQUE, customer_id BIGINT UNSIGNED NOT NULL DEFAULT 0, customer_name VARCHAR(200) NOT NULL DEFAULT '', customer_email VARCHAR(200) NOT NULL DEFAULT '', status VARCHAR(50) NOT NULL DEFAULT 'pending', subtotal DECIMAL(20,6) NOT NULL DEFAULT 0, discount DECIMAL(20,6) NOT NULL DEFAULT 0, total DECIMAL(20,6) NOT NULL DEFAULT 0, currency VARCHAR(10) NOT NULL DEFAULT 'USD', note_customer LONGTEXT NULL, note_admin LONGTEXT NULL, expires_at DATETIME NULL, converted_order_id BIGINT UNSIGNED NULL DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_customer (customer_id), KEY idx_status (status), KEY idx_created (created_at) ) $charset; CREATE TABLE wp_b2b_quote_items ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, quote_id BIGINT UNSIGNED NOT NULL, product_id BIGINT UNSIGNED NOT NULL, variation_id BIGINT UNSIGNED NOT NULL DEFAULT 0, name VARCHAR(200) NOT NULL DEFAULT '', sku VARCHAR(100) NOT NULL DEFAULT '', quantity DECIMAL(10,2) NOT NULL DEFAULT 1, unit_price DECIMAL(20,6) NOT NULL DEFAULT 0, line_total DECIMAL(20,6) NOT NULL DEFAULT 0, meta_data LONGTEXT NULL, PRIMARY KEY (id), KEY idx_quote (quote_id) ) $charset; CREATE TABLE wp_b2b_quote_notes ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, quote_id BIGINT UNSIGNED NOT NULL, author_id BIGINT UNSIGNED NOT NULL DEFAULT 0, type VARCHAR(20) NOT NULL DEFAULT 'admin', content LONGTEXT NOT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_quote (quote_id) ) $charset; CREATE TABLE wp_b2b_pricing_rules ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, rule_type VARCHAR(50) NOT NULL DEFAULT 'role', role VARCHAR(100) NOT NULL DEFAULT '', user_id BIGINT UNSIGNED NOT NULL DEFAULT 0, product_id BIGINT UNSIGNED NOT NULL DEFAULT 0, category_id BIGINT UNSIGNED NOT NULL DEFAULT 0, min_qty DECIMAL(10,2) NOT NULL DEFAULT 0, max_qty DECIMAL(10,2) NOT NULL DEFAULT 0, discount_type VARCHAR(20) NOT NULL DEFAULT 'percentage', discount_value DECIMAL(20,6) NOT NULL DEFAULT 0, fixed_price DECIMAL(20,6) NOT NULL DEFAULT 0, priority INT NOT NULL DEFAULT 10, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_role (role), KEY idx_product (product_id), KEY idx_category (category_id), KEY idx_rule_type (rule_type) ) $charset; CREATE TABLE wp_b2b_registrations ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id BIGINT UNSIGNED NOT NULL DEFAULT 0, company_name VARCHAR(200) NOT NULL DEFAULT '', vat_number VARCHAR(100) NOT NULL DEFAULT '', phone VARCHAR(50) NOT NULL DEFAULT '', country VARCHAR(10) NOT NULL DEFAULT '', status VARCHAR(20) NOT NULL DEFAULT 'pending', notes LONGTEXT NULL, documents LONGTEXT NULL, reviewed_by BIGINT UNSIGNED NOT NULL DEFAULT 0, reviewed_at DATETIME NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_user (user_id), KEY idx_status (status) ) $charset; CREATE TABLE wp_b2b_leads ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, type VARCHAR(50) NOT NULL DEFAULT 'inquiry', name VARCHAR(200) NOT NULL DEFAULT '', email VARCHAR(200) NOT NULL DEFAULT '', phone VARCHAR(100) NOT NULL DEFAULT '', product_id BIGINT UNSIGNED NOT NULL DEFAULT 0, message LONGTEXT NULL, source VARCHAR(100) NOT NULL DEFAULT '', utm_source VARCHAR(100) NOT NULL DEFAULT '', utm_medium VARCHAR(100) NOT NULL DEFAULT '', utm_campaign VARCHAR(100) NOT NULL DEFAULT '', status VARCHAR(20) NOT NULL DEFAULT 'new', assigned_to BIGINT UNSIGNED NOT NULL DEFAULT 0, crm_contact_id VARCHAR(200) NOT NULL DEFAULT '', meta LONGTEXT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_status (status), KEY idx_product (product_id), KEY idx_email (email(100)) ) $charset; CREATE TABLE wp_b2b_saved_carts ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id BIGINT UNSIGNED NOT NULL, label VARCHAR(200) NOT NULL DEFAULT '', cart_data LONGTEXT NOT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_user (user_id) ) $charset; CREATE TABLE wp_b2b_automation_logs ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, rule_key VARCHAR(100) NOT NULL DEFAULT '', object_id BIGINT UNSIGNED NOT NULL DEFAULT 0, object_type VARCHAR(50) NOT NULL DEFAULT '', status VARCHAR(20) NOT NULL DEFAULT 'sent', meta LONGTEXT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_rule (rule_key), KEY idx_object (object_id, object_type) ) $charset; CREATE TABLE wp_b2b_analytics_events ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, event_type VARCHAR(100) NOT NULL DEFAULT '', user_id BIGINT UNSIGNED NOT NULL DEFAULT 0, object_id BIGINT UNSIGNED NOT NULL DEFAULT 0, object_type VARCHAR(50) NOT NULL DEFAULT '', value DECIMAL(20,6) NOT NULL DEFAULT 0, meta LONGTEXT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_event (event_type), KEY idx_user (user_id), KEY idx_created (created_at) ) $charset; CREATE TABLE wp_b2b_sales_reps ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, rep_user_id BIGINT UNSIGNED NOT NULL, customer_id BIGINT UNSIGNED NOT NULL DEFAULT 0, team VARCHAR(100) NOT NULL DEFAULT '', commission DECIMAL(5,2) NOT NULL DEFAULT 0, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_rep (rep_user_id), KEY idx_customer (customer_id) ) $charset; CREATE TABLE wp_b2b_notifications ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id BIGINT UNSIGNED NOT NULL, type VARCHAR(50) NOT NULL DEFAULT '', title VARCHAR(255) NOT NULL DEFAULT '', message LONGTEXT NOT NULL, link VARCHAR(500) NOT NULL DEFAULT '', read_at DATETIME NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_user (user_id), KEY idx_read (read_at), KEY idx_created (created_at) ) $charset; CREATE TABLE wp_b2b_price_books ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT '', start_date DATE NULL, end_date DATE NULL, status VARCHAR(20) NOT NULL DEFAULT 'active', priority INT NOT NULL DEFAULT 10, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_status (status) ) $charset; CREATE TABLE wp_b2b_price_book_items ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, price_book_id BIGINT UNSIGNED NOT NULL, item_type VARCHAR(20) NOT NULL DEFAULT 'product', object_id BIGINT UNSIGNED NOT NULL DEFAULT 0, price_type VARCHAR(30) NOT NULL DEFAULT 'fixed', value DECIMAL(20,6) NOT NULL DEFAULT 0, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_book (price_book_id), KEY idx_object (object_id, item_type) ) $charset; CREATE TABLE wp_b2b_price_book_assignments ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, price_book_id BIGINT UNSIGNED NOT NULL, user_id BIGINT UNSIGNED NOT NULL DEFAULT 0, company_id BIGINT UNSIGNED NOT NULL DEFAULT 0, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_book (price_book_id), KEY idx_user (user_id), KEY idx_company (company_id) ) $charset; CREATE TABLE wp_b2b_credit_accounts ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id BIGINT UNSIGNED NOT NULL, credit_limit DECIMAL(20,6) NOT NULL DEFAULT 0, balance_used DECIMAL(20,6) NOT NULL DEFAULT 0, terms VARCHAR(20) NOT NULL DEFAULT 'net30', status VARCHAR(20) NOT NULL DEFAULT 'active', created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY user_id (user_id) ) $charset; CREATE TABLE wp_b2b_companies ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT '', admin_user_id BIGINT UNSIGNED NOT NULL DEFAULT 0, vat_number VARCHAR(100) NOT NULL DEFAULT '', credit_limit DECIMAL(20,6) NOT NULL DEFAULT 0, status VARCHAR(20) NOT NULL DEFAULT 'active', created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) ) $charset; CREATE TABLE wp_b2b_company_members ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, company_id BIGINT UNSIGNED NOT NULL, user_id BIGINT UNSIGNED NOT NULL, member_role VARCHAR(20) NOT NULL DEFAULT 'buyer', joined_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY user_id (user_id), KEY idx_company (company_id) ) $charset; CREATE TABLE wp_b2b_visibility_rules ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, rule_type VARCHAR(20) NOT NULL DEFAULT 'product', object_id BIGINT UNSIGNED NOT NULL DEFAULT 0, roles LONGTEXT NULL, companies LONGTEXT NULL, action VARCHAR(10) NOT NULL DEFAULT 'hide', priority INT NOT NULL DEFAULT 10, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY idx_type (rule_type), KEY idx_object (object_id) ) $charset; CREATE TABLE wp_b2b_invoices ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, order_id BIGINT UNSIGNED NOT NULL, invoice_number VARCHAR(50) NOT NULL, user_id BIGINT UNSIGNED NOT NULL DEFAULT 0, total DECIMAL(20,6) NOT NULL DEFAULT 0, status VARCHAR(20) NOT NULL DEFAULT 'issued', issued_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, due_at DATETIME NULL, PRIMARY KEY (id), UNIQUE KEY order_id (order_id), UNIQUE KEY invoice_number (invoice_number), KEY idx_user (user_id) ) $charset; \"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta( $sql );"},{"table_name":"b2b_registrations","full_table_name":"wp_b2b_registrations","description":"Stores b2b registrations data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_sales_reps","full_table_name":"wp_b2b_sales_reps","description":"Stores b2b sales reps data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_saved_carts","full_table_name":"wp_b2b_saved_carts","description":"Stores b2b saved carts data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null},{"table_name":"b2b_visibility_rules","full_table_name":"wp_b2b_visibility_rules","description":"Stores b2b visibility rules data created by this plugin.","detection_method":"static","confidence":"medium","columns":[],"create_sql":null}],"table_count":19}