CREATE TABLE agent_profile (nickname VARCHAR(10), commission_first_percent TINYINT DEFAULT 30, commission_recurring_percent TINYINT DEFAULT 30, commission_fix BIGINT DEFAULT 0, is_active TINYINT(1) DEFAULT '1', subscription_id BIGINT, manager_agent VARCHAR(10), is_manager TINYINT(1) DEFAULT '0', is_account_handler TINYINT(1) DEFAULT '0', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX subscription_id_idx (subscription_id), PRIMARY KEY(nickname)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE api_error (id BIGINT AUTO_INCREMENT, api VARCHAR(20), error text, widget_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE api_usage (id BIGINT AUTO_INCREMENT, type VARCHAR(50) NOT NULL, query VARCHAR(200), ip VARCHAR(45), created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE async_process (id BIGINT AUTO_INCREMENT, company_id BIGINT, source_id BIGINT, type VARCHAR(50), error VARCHAR(200), params LONGTEXT, done_at datetime, created_at DATETIME NOT NULL, INDEX company_id_idx (company_id), INDEX source_id_idx (source_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE async_process_brightdata (id BIGINT AUTO_INCREMENT, aspr_id BIGINT, job_id VARCHAR(100), status VARCHAR(20) DEFAULT 'init' NOT NULL, job_done_at datetime, job_recieved_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX aspr_id_idx (aspr_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE async_process_datashake (id BIGINT AUTO_INCREMENT, aspr_id BIGINT, job_id BIGINT, status VARCHAR(20) DEFAULT 'init' NOT NULL, credits BIGINT, job_done_at datetime, job_recieved_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX aspr_id_idx (aspr_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE async_process_page_request (id BIGINT AUTO_INCREMENT, type VARCHAR(50), page_id text, access_token LONGTEXT, webhook_url VARCHAR(255), email VARCHAR(255), token VARCHAR(50), reviews LONGTEXT COLLATE utf8mb4_general_ci, details LONGTEXT COLLATE utf8mb4_general_ci, error VARCHAR(255), requested_number MEDIUMINT DEFAULT 0, last_requested_at datetime, synced_at datetime, webhook_called_at datetime, is_in_progress TINYINT(1) DEFAULT '1', deleted_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE blacklisted_ip_address (id BIGINT AUTO_INCREMENT, ip_address VARCHAR(45), user_name VARCHAR(100), subscription_id BIGINT, expires_at datetime, deleted_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE campaign_mail (id BIGINT AUTO_INCREMENT, template VARCHAR(64), blacklist VARCHAR(64), list VARCHAR(64), source VARCHAR(128), subscription_campaign VARCHAR(128), senders text, partners BIGINT DEFAULT 0, total BIGINT DEFAULT 0, sent BIGINT DEFAULT 0, openings BIGINT DEFAULT 0, clicks BIGINT DEFAULT 0, unsubscribes BIGINT DEFAULT 0, language VARCHAR(2) DEFAULT 'en', events text, start_at datetime, finished_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME, INDEX template_idx (template), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE campaign_queue (id BIGINT AUTO_INCREMENT, mail_id BIGINT, email VARCHAR(255), name VARCHAR(255), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX mail_id_idx (mail_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE cms_blog_category (id BIGINT AUTO_INCREMENT, title VARCHAR(200), slug VARCHAR(200), language VARCHAR(2), description text, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE cms_blog_item (id BIGINT AUTO_INCREMENT, meta_description LONGTEXT, title VARCHAR(200), slug VARCHAR(200), content LONGTEXT, rich_snippet text, language VARCHAR(2), created_at DATETIME NOT NULL, tags LONGTEXT, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE cms_help_tag (id BIGINT AUTO_INCREMENT, name VARCHAR(200), slug VARCHAR(200), category VARCHAR(40), synonyms LONGTEXT, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company (id BIGINT AUTO_INCREMENT, name VARCHAR(100), website text, description TEXT, phone VARCHAR(20), email VARCHAR(100), review_count INT DEFAULT 0, review_score DECIMAL(3, 1) DEFAULT 0, employee_number VARCHAR(50), founded_at SMALLINT, company_category_id BIGINT, new_review_notify_email VARCHAR(100), video_url text, has_seller_ratings TINYINT(1) DEFAULT '0' NOT NULL, verified_ti TINYINT(1) DEFAULT '0' NOT NULL, verified_self TINYINT(1) DEFAULT '0' NOT NULL, hidden TINYINT(1) DEFAULT '0' NOT NULL, webshop_type VARCHAR(20), social_instagram text, social_youtube text, social_linkedin text, social_pinterest text, social_skype text, social_tumblr text, social_tiktok text, social_twitter text, social_viber text, social_vimeo text, social_whatsapp text, default_language VARCHAR(2), enabled_languages longtext, server_location VARCHAR(6), meta_edited_at datetime, tags LONGTEXT, sell_type VARCHAR(10), slug VARCHAR(200), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_category_id_idx (company_category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_account_handler_subscription_relation (id BIGINT AUTO_INCREMENT, company_id BIGINT, account_handler_subscription_id BIGINT, status VARCHAR(20) DEFAULT 'pending' NOT NULL, initiator VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), INDEX account_handler_subscription_id_idx (account_handler_subscription_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_address (id BIGINT AUTO_INCREMENT, company_id BIGINT, type VARCHAR(20), name VARCHAR(100), country VARCHAR(2), zip VARCHAR(10), city VARCHAR(100), street VARCHAR(100), number VARCHAR(40), comment VARCHAR(255), phone VARCHAR(20), google_pb VARCHAR(255), lat VARCHAR(19), lng VARCHAR(19), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_ai_settings (id BIGINT AUTO_INCREMENT, parent_id BIGINT, company_id BIGINT, auto_suggest TINYINT(1) DEFAULT '1', emojis TINYINT(1) DEFAULT '0', signature text(255), ratings LONGTEXT, length BIGINT, auto_exclude_length BIGINT, keywords text(255), exclude_keywords text(255), auto_exclude_keywords text(255), calling_by_name TINYINT(1) DEFAULT '1', single_person TINYINT(1) DEFAULT '0', mention_names TINYINT(1) DEFAULT '1', tonality VARCHAR(10) DEFAULT 'default' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_category (id BIGINT AUTO_INCREMENT, parent_id BIGINT, name VARCHAR(255), slug VARCHAR(255), icon VARCHAR(255), color VARCHAR(8), priority INT, total_companies_count INT DEFAULT 0 NOT NULL, valid_companies_count INT DEFAULT 0 NOT NULL, is_active TINYINT(1) DEFAULT '1' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME, INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_change (id BIGINT AUTO_INCREMENT, company_id BIGINT, fields LONGTEXT, old_slug VARCHAR(100), note text, state VARCHAR(10) DEFAULT 'init' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX old_slug_idx (old_slug), INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_company_category (company_id BIGINT, company_category_id BIGINT, PRIMARY KEY(company_id, company_category_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_offer (id BIGINT AUTO_INCREMENT, company_id BIGINT, title VARCHAR(200), offer TEXT, language VARCHAR(2) DEFAULT 'en', target_url VARCHAR(250), date_from datetime, date_to datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_offer_click (id BIGINT AUTO_INCREMENT, company_offer_id BIGINT, clicked_at datetime, INDEX company_offer_id_idx (company_offer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_offer_view (id BIGINT AUTO_INCREMENT, company_offer_id BIGINT, viewed_at datetime, INDEX company_offer_id_idx (company_offer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_subscription_relation (id BIGINT AUTO_INCREMENT, company_id BIGINT, subscription_id BIGINT, INDEX subscription_id_idx (subscription_id), INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_summary (id BIGINT AUTO_INCREMENT, company_id BIGINT, language VARCHAR(2) DEFAULT 'en', text LONGTEXT COLLATE utf8mb4_general_ci, list LONGTEXT COLLATE utf8mb4_general_ci, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_translation (id BIGINT AUTO_INCREMENT, company_id BIGINT, language VARCHAR(2) DEFAULT 'en', name VARCHAR(100), website text, description TEXT, phone VARCHAR(20), email VARCHAR(100), INDEX lang_idx_idx (company_id, language), INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE company_user_relation (id BIGINT AUTO_INCREMENT, user_id BIGINT, company_id BIGINT, last_reviews_seen_at datetime, INDEX user_id_idx (user_id), INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE date_format (id TINYINT AUTO_INCREMENT, position TINYINT, php VARCHAR(20), js VARCHAR(20), language VARCHAR(2), default_cultures VARCHAR(100), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE email_status (id BIGINT AUTO_INCREMENT, subscription_id BIGINT, email_address VARCHAR(255), status VARCHAR(10) DEFAULT 'pending' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX subscription_id_idx (subscription_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE feed_cache (id BIGINT AUTO_INCREMENT, type VARCHAR(20) DEFAULT 'Facebook' NOT NULL COLLATE utf8mb4_general_ci, subtype VARCHAR(25) DEFAULT 'none' NOT NULL COLLATE utf8mb4_general_ci, page_id VARCHAR(255) COLLATE utf8mb4_general_ci, profile_data LONGTEXT COLLATE utf8mb4_general_ci, posts LONGTEXT COLLATE utf8mb4_general_ci, downloaded_at datetime, created_at DATETIME NOT NULL, UNIQUE INDEX feed_page_id_by_type_unique_idx (page_id, type, subtype), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE integration (id BIGINT AUTO_INCREMENT, type VARCHAR(25) DEFAULT 'shopify-collector' NOT NULL, type_id VARCHAR(200), token VARCHAR(255), subscription_id BIGINT, company_id BIGINT, params LONGTEXT, rate_us_feedback TINYINT, deleted_at datetime, hash VARCHAR(200), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX subscription_id_idx (subscription_id), INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE login_error_log (id BIGINT AUTO_INCREMENT, ip_address VARCHAR(45), user_name VARCHAR(100), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE mail (id BIGINT AUTO_INCREMENT, subject VARCHAR(200), body_html LONGTEXT, from_name VARCHAR(40), from_mail VARCHAR(40), template VARCHAR(20) DEFAULT 'email' NOT NULL, group_id BIGINT, lang VARCHAR(2), description VARCHAR(200), type VARCHAR(20) DEFAULT 'system' NOT NULL, link_text VARCHAR(100), link_href VARCHAR(100), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE mail_sent (id BIGINT AUTO_INCREMENT, source VARCHAR(30) NOT NULL, source_id BIGINT, mail_id BIGINT, sent_at datetime, viewed_at datetime, viewed_num TINYINT UNSIGNED DEFAULT 0 NOT NULL, clicked_at datetime, clicked_num TINYINT UNSIGNED DEFAULT 0 NOT NULL, unsubscribed_at datetime, INDEX foreign_index_idx (source, source_id), INDEX mail_id_idx (mail_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE marketing_campaign (id BIGINT AUTO_INCREMENT, name VARCHAR(40), statuses LONGTEXT, delete_after_finish TINYINT(1), color VARCHAR(6), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE marketing_campaign_event (id BIGINT AUTO_INCREMENT, subscription_id BIGINT, marketing_campaign_id BIGINT, status_id BIGINT, comment VARCHAR(100), sender_user_id BIGINT, created_at DATETIME NOT NULL, INDEX subscription_id_idx (subscription_id), INDEX marketing_campaign_id_idx (marketing_campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE marketing_campaign_subscription_relation (id BIGINT AUTO_INCREMENT, subscription_id BIGINT, marketing_campaign_id BIGINT, status_id BIGINT, comment VARCHAR(100), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX subscription_id_idx (subscription_id), INDEX marketing_campaign_id_idx (marketing_campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE name_format (id TINYINT AUTO_INCREMENT, sample VARCHAR(20), regex VARCHAR(40), ucfirst TINYINT(1), toupper TINYINT(1), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE payment (id BIGINT AUTO_INCREMENT, amount DOUBLE(8, 2), currency VARCHAR(3) DEFAULT 'USD' NOT NULL, item VARCHAR(40), method VARCHAR(20) DEFAULT 'PayPal' NOT NULL, user_id BIGINT, subscription_id BIGINT, transaction_id VARCHAR(100), invoice_id VARCHAR(60), details LONGTEXT, status VARCHAR(10) DEFAULT 'pending' NOT NULL, commission DOUBLE(8, 2), commission_paid_at datetime, sequence MEDIUMINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX item_idx (item), INDEX user_id_idx (user_id), INDEX subscription_id_idx (subscription_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE payment_dispute (id BIGINT AUTO_INCREMENT, payment_id BIGINT, transaction_id VARCHAR(100), dispute_id VARCHAR(100), details LONGTEXT, status VARCHAR(40), due_at datetime, user_contacted_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX payment_id_idx (payment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE pre_profile (id BIGINT AUTO_INCREMENT, email VARCHAR(100), password VARCHAR(100), website VARCHAR(100), first_name VARCHAR(50), last_name VARCHAR(50), phone VARCHAR(20), agent_id VARCHAR(10), campaign_id VARCHAR(20), language VARCHAR(2) DEFAULT 'en' NOT NULL, package VARCHAR(10) DEFAULT 'free' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE product (id BIGINT AUTO_INCREMENT, external_db_id VARCHAR(100), company_id BIGINT, gtin VARCHAR(40), category VARCHAR(100), manufacturer VARCHAR(100), name VARCHAR(200), image TEXT, alias LONGTEXT, description LONGTEXT, params LONGTEXT, stat LONGTEXT, shop_ids LONGTEXT, url TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE product_order (id BIGINT AUTO_INCREMENT, order_key VARCHAR(100), price DOUBLE(8, 2), currency VARCHAR(3), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE product_order_product_relation (id BIGINT AUTO_INCREMENT, product_order_id BIGINT, product_id BIGINT, product_variant_id BIGINT, product_variant_price_id BIGINT, qty BIGINT, INDEX product_order_id_idx (product_order_id), INDEX product_id_idx (product_id), INDEX product_variant_id_idx (product_variant_id), INDEX product_variant_price_id_idx (product_variant_price_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE product_review (id BIGINT AUTO_INCREMENT, product_id BIGINT, reviewer_name VARCHAR(200), reviewer_id VARCHAR(200), reviewer_photo TEXT, rating DECIMAL(3, 1), ratings LONGTEXT, text LONGTEXT, photos LONGTEXT, language VARCHAR(2), product_order_id BIGINT, is_hidden TINYINT(1) DEFAULT '0', is_spam TINYINT(1) DEFAULT '0', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX product_id_idx (product_id), INDEX product_order_id_idx (product_order_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE product_variant (id BIGINT AUTO_INCREMENT, product_id BIGINT, name VARCHAR(200), current_price DOUBLE(8, 2), current_currency VARCHAR(3), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX product_id_idx (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE product_variant_price (id BIGINT AUTO_INCREMENT, product_variant_id BIGINT, price DOUBLE(8, 2), currency VARCHAR(3), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX product_variant_id_idx (product_variant_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE profile (id BIGINT AUTO_INCREMENT, user_id BIGINT, language VARCHAR(2) DEFAULT 'en' NOT NULL, phone VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE profile_analysis (id BIGINT AUTO_INCREMENT, source_id BIGINT, has_trustindex TINYINT(1) DEFAULT '0', user_id BIGINT, error VARCHAR(255), platform VARCHAR(25) DEFAULT 'Google' NOT NULL, status VARCHAR(10) DEFAULT 'init' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX platform_idx_idx (platform), INDEX source_id_idx (source_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE profile_analysis_attribute (id BIGINT AUTO_INCREMENT, analysis_id BIGINT, analysis_attribute_info_id BIGINT, value text, bool_value TINYINT(1), INDEX analysis_id_idx (analysis_id), INDEX analysis_attribute_info_id_idx (analysis_attribute_info_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE profile_analysis_attribute_info (id BIGINT AUTO_INCREMENT, main_category VARCHAR(100), sub_category VARCHAR(100), name VARCHAR(100), note text, guide text, is_ranking_factor TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE profile_analysis_log (id BIGINT AUTO_INCREMENT, user_id BIGINT, analysis_id BIGINT, created_at DATETIME NOT NULL, INDEX user_id_idx (user_id), INDEX analysis_id_idx (analysis_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE profile_social_platform (id BIGINT AUTO_INCREMENT, user_id BIGINT, platform VARCHAR(20) DEFAULT 'Facebook' NOT NULL, platform_id VARCHAR(30), access_token LONGTEXT, created_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE public_html_generate (id BIGINT AUTO_INCREMENT, company_id BIGINT, reviewer_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), INDEX reviewer_id_idx (reviewer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE ranking_process (id BIGINT AUTO_INCREMENT, source_id BIGINT NOT NULL, user_id BIGINT, keyword VARCHAR(255) NOT NULL, location VARCHAR(255), lat VARCHAR(19), lng VARCHAR(19), circle_range SMALLINT DEFAULT 5 NOT NULL, distance_unit TINYINT NOT NULL, error VARCHAR(255), scanned_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX keyword_idx (keyword), INDEX source_id_idx (source_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE ranking_result (id BIGINT AUTO_INCREMENT, ranking_process_id BIGINT NOT NULL, position VARCHAR(4) NOT NULL, created_at DATETIME NOT NULL, INDEX position_idx (position), INDEX ranking_process_id_idx (ranking_process_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE recommendation (id BIGINT AUTO_INCREMENT, subscription_id BIGINT, email_address VARCHAR(50), name VARCHAR(50), registered_subscription_id BIGINT, status VARCHAR(10) DEFAULT 'init' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX subscription_id_idx (subscription_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review (id BIGINT AUTO_INCREMENT, source_id BIGINT, version TINYINT(1) DEFAULT '0', created_at datetime, review_id VARCHAR(40), reviewer_name VARCHAR(200) COLLATE utf8mb4_general_ci, reviewer_id VARCHAR(200), reviewer_photo TEXT, rating DECIMAL(3, 1), details LONGTEXT, recommendation_type VARCHAR(10), text LONGTEXT COLLATE utf8mb4_general_ci, photos LONGTEXT COLLATE utf8mb4_general_ci, language VARCHAR(2), comment VARCHAR(200) COLLATE utf8mb4_general_ci, highlight VARCHAR(11), is_hidden TINYINT(1) DEFAULT '0', is_spam TINYINT(1) DEFAULT '0', reply LONGTEXT COLLATE utf8mb4_general_ci, reply_at datetime, like_count INT DEFAULT 0, dislike_count INT DEFAULT 0, INDEX language_idx_idx (language), INDEX reviewer_id_idx_idx (reviewer_id), INDEX source_id_idx (source_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_invite (id BIGINT AUTO_INCREMENT, review_invite_campaign_id BIGINT, email VARCHAR(120), name VARCHAR(120), is_cancelled TINYINT(1) DEFAULT '0', is_automatic TINYINT(1) DEFAULT '0', created_at datetime, sent_at datetime, reminded_at datetime, clicked_at datetime, denied_at datetime, sys_denied_at datetime, sys_deny_reason VARCHAR(10), order_id VARCHAR(20), support_feedback LONGTEXT COLLATE utf8mb4_general_ci, support_feedback_at datetime, opened_at datetime, INDEX status_idx_idx (is_cancelled, review_invite_campaign_id), INDEX review_invite_campaign_id_idx (review_invite_campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_invite_campaign (id BIGINT AUTO_INCREMENT, name VARCHAR(100), company_id BIGINT, source_id BIGINT, subject1 text(255), html_template1 LONGTEXT COLLATE utf8mb4_general_ci, subject2 text(255), html_template2 LONGTEXT COLLATE utf8mb4_general_ci, sender_name VARCHAR(100), sender_email VARCHAR(100), reply_to VARCHAR(100), sender_domain_whitelist LONGTEXT, sender_mode VARCHAR(10), sender_id BIGINT, delay_hours SMALLINT, reminder_hours MEDIUMINT, error LONGTEXT, avoid_negative_review_is_active TINYINT(1) DEFAULT '1', is_active TINYINT(1) DEFAULT '0', is_limited TINYINT(1) DEFAULT '0', platform_url LONGTEXT, trigger_event VARCHAR(50), frequency TINYINT, html_footer_template LONGTEXT COLLATE utf8mb4_general_ci, support_form_language VARCHAR(2) DEFAULT 'en', exclude_emails LONGTEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX delay_idx_idx (delay_hours), INDEX reminder_idx_idx (reminder_hours), INDEX company_id_idx (company_id), INDEX source_id_idx (source_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_invite_cancellation (id BIGINT AUTO_INCREMENT, email VARCHAR(120), company_id BIGINT, created_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_invite_card (id BIGINT AUTO_INCREMENT, company_id BIGINT, name VARCHAR(200), url text, type VARCHAR(10) DEFAULT 'qr', payment_id BIGINT, address LONGTEXT, programmed_at datetime, posted_at datetime, first_used_at datetime, blocked_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), INDEX payment_id_idx (payment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_invite_card_view (id BIGINT AUTO_INCREMENT, review_invite_card_id BIGINT, viewed_at_date DATE, viewed_at_time TIME, INDEX review_invite_card_id_idx (review_invite_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_like (id BIGINT AUTO_INCREMENT, review_id BIGINT, reviewer_id BIGINT, is_liked TINYINT(1) DEFAULT '0', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX review_id_idx (review_id), INDEX reviewer_id_idx (reviewer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_reply_ai (id BIGINT AUTO_INCREMENT, review_id BIGINT, company_id BIGINT, review_text text, original_reply text, edited_reply text, type VARCHAR(10) DEFAULT 'manual' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX review_id_idx (review_id), INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_review_tag_relation (id BIGINT AUTO_INCREMENT, review_id BIGINT, review_tag_id BIGINT, is_automatic TINYINT(1) DEFAULT '0', is_deleted TINYINT(1) DEFAULT '0', created_at DATETIME NOT NULL, UNIQUE INDEX review_review_tag_idx_idx (review_id, review_tag_id), INDEX review_tag_id_idx (review_tag_id), INDEX review_id_idx (review_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_spam_log (id BIGINT AUTO_INCREMENT, source_id BIGINT, version TINYINT(1) DEFAULT '0', review_created_at datetime, review_id VARCHAR(40), reviewer_name VARCHAR(200) COLLATE utf8mb4_general_ci, reviewer_id VARCHAR(200), reviewer_photo TEXT, rating DECIMAL(3, 1), details LONGTEXT, recommendation_type VARCHAR(10), text LONGTEXT COLLATE utf8mb4_general_ci, photos LONGTEXT COLLATE utf8mb4_general_ci, language VARCHAR(2), comment VARCHAR(200) COLLATE utf8mb4_general_ci, highlight VARCHAR(11), is_hidden TINYINT(1) DEFAULT '0', reply LONGTEXT COLLATE utf8mb4_general_ci, reply_at datetime, like_count INT DEFAULT 0, dislike_count INT DEFAULT 0, admin_reporter_id BIGINT, public_reporter_id BIGINT, reason TINYINT, reason_comment VARCHAR(255), order_id_requested_at datetime, judged_at datetime, created_at DATETIME NOT NULL, INDEX source_id_idx (source_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_spam_report (id BIGINT AUTO_INCREMENT, review_id BIGINT, user_id BIGINT, public_user_id BIGINT, reason TINYINT, reason_comment VARCHAR(255), judgement TINYINT, notify_email VARCHAR(100), is_checked TINYINT(1) DEFAULT '0', order_id_requested_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX review_id_idx (review_id), INDEX user_id_idx (user_id), INDEX public_user_id_idx (public_user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_spammer (id BIGINT AUTO_INCREMENT, reviewer_id BIGINT, times TINYINT, INDEX reviewer_id_idx (reviewer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_spammer_company (id BIGINT AUTO_INCREMENT, company_id BIGINT, spam_count SMALLINT UNSIGNED DEFAULT 1, last_spam_created_at datetime, blocked_at datetime, created_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_spammer_domain (id BIGINT AUTO_INCREMENT, domain VARCHAR(255), spam_count SMALLINT UNSIGNED DEFAULT 1, last_spam_created_at datetime, blocked_at datetime, created_at DATETIME NOT NULL, INDEX domain_idx_idx (domain), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_tag (id BIGINT AUTO_INCREMENT, company_id BIGINT, name VARCHAR(30) COLLATE utf8mb4_general_ci, words LONGTEXT, excluding_words LONGTEXT, label VARCHAR(10) DEFAULT 'primary' NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE review_translation (id BIGINT AUTO_INCREMENT, review_id BIGINT, language VARCHAR(2) DEFAULT 'en', text LONGTEXT COLLATE utf8mb4_general_ci, reply LONGTEXT COLLATE utf8mb4_general_ci, INDEX lang_idx_idx (review_id, language), INDEX review_id_idx (review_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE reviewer (id BIGINT AUTO_INCREMENT, name VARCHAR(200), email VARCHAR(200), photo TEXT, hash VARCHAR(200), social VARCHAR(20), social_id VARCHAR(30), country VARCHAR(2), last_login_ip VARCHAR(45), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX email_idx_idx (email), INDEX hash_idx_idx (hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_abia (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_alibaba (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_argep (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_auto_scout24 (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_bookatable (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_capterra (id BIGINT AUTO_INCREMENT, category VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_checkatrade (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_easyweddings (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_fresha (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', page BIGINT DEFAULT 1, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_opentable (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_provenexpert (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_realself (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_reviewsio (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_sitejabber (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_sourceforge (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_tripadvisor (id BIGINT AUTO_INCREMENT, siteindex VARCHAR(200), sort VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_trustatrader (id BIGINT AUTO_INCREMENT, link VARCHAR(255), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_trustratings (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_vardense (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_whichtrustedtraders (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_zillow (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE scrap_zoover (id BIGINT AUTO_INCREMENT, link VARCHAR(200), is_done TINYINT(1) DEFAULT '0', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE service_question (id BIGINT AUTO_INCREMENT, company_id BIGINT, reviewer_id BIGINT, content text, tags LONGTEXT, is_hidden TINYINT(1) DEFAULT '0', is_spam TINYINT(1) DEFAULT '0', created_at datetime, INDEX company_id_idx (company_id), INDEX reviewer_id_idx (reviewer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE service_question_answer (id BIGINT AUTO_INCREMENT, service_question_id BIGINT, reviewer_id BIGINT, content text, photos LONGTEXT, like_count INT DEFAULT 0, dislike_count INT DEFAULT 0, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX service_question_id_idx (service_question_id), INDEX reviewer_id_idx (reviewer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE service_question_answer_like (id BIGINT AUTO_INCREMENT, service_question_answer_id BIGINT, reviewer_id BIGINT, is_liked TINYINT(1) DEFAULT '0', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX service_question_answer_id_idx (service_question_answer_id), INDEX reviewer_id_idx (reviewer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE service_question_spam_report (id BIGINT AUTO_INCREMENT, service_question_id BIGINT, user_id BIGINT, is_checked TINYINT(1) DEFAULT '0', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX service_question_id_idx (service_question_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE setting (id BIGINT AUTO_INCREMENT, description VARCHAR(100), value LONGTEXT, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE shopify_comparison (id BIGINT AUTO_INCREMENT, slug VARCHAR(200), stat LONGTEXT, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source (id BIGINT AUTO_INCREMENT, company_id BIGINT, type VARCHAR(25) DEFAULT 'Facebook' NOT NULL, name VARCHAR(100), description VARCHAR(100), access_token LONGTEXT, access_token_expire_at datetime, page_id TEXT, page_url TEXT, avatar_url TEXT, stat LONGTEXT, downloaded_at datetime, synced_at datetime, page_id_checked_at datetime, error LONGTEXT, error_at datetime, error_number TINYINT UNSIGNED, is_in_progress TINYINT(1) DEFAULT '1', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_brightdata (id BIGINT AUTO_INCREMENT, source_id BIGINT, job_id VARCHAR(100), type VARCHAR(20) DEFAULT 'single' NOT NULL, status VARCHAR(20) DEFAULT 'init' NOT NULL, mode VARCHAR(20) DEFAULT 'new' NOT NULL, download_limit BIGINT, job_done_at datetime, job_recieved_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX source_id_idx (source_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_datashake (id BIGINT AUTO_INCREMENT, source_id BIGINT, job_id BIGINT, status VARCHAR(20) DEFAULT 'init' NOT NULL, mode VARCHAR(20) DEFAULT 'new' NOT NULL, download_limit BIGINT, credits BIGINT, job_done_at datetime, job_recieved_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX source_id_idx (source_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_feed (id BIGINT AUTO_INCREMENT, company_id BIGINT, type VARCHAR(20) DEFAULT 'Facebook' NOT NULL COLLATE utf8mb4_general_ci, subtype VARCHAR(25) DEFAULT 'none' NOT NULL COLLATE utf8mb4_general_ci, name VARCHAR(100), description VARCHAR(100), access_token LONGTEXT, access_token_expire_at datetime, page_id TEXT, user_id TEXT, page_url TEXT, avatar_url TEXT, stat LONGTEXT, page_id_checked_at datetime, error LONGTEXT, error_at datetime, error_number TINYINT UNSIGNED, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_feed_invite (id BIGINT AUTO_INCREMENT, company_id BIGINT, source_feed_id BIGINT, type VARCHAR(50), email VARCHAR(250), hash VARCHAR(200), expires_at datetime, added_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_feed_wordpress (id BIGINT AUTO_INCREMENT, website VARCHAR(255), email VARCHAR(255), type VARCHAR(20) DEFAULT 'Facebook' NOT NULL COLLATE utf8mb4_general_ci, subtype VARCHAR(25) DEFAULT 'none' NOT NULL COLLATE utf8mb4_general_ci, name VARCHAR(100), access_token LONGTEXT, access_token_expire_at datetime, refresh_token LONGTEXT, page_id TEXT, user_id TEXT, error LONGTEXT, error_at datetime, error_number SMALLINT, last_generated_at datetime, deleted_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_invite (id BIGINT AUTO_INCREMENT, company_id BIGINT, source_id BIGINT, type VARCHAR(50), email VARCHAR(250), hash VARCHAR(200), expires_at datetime, added_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_abia (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, street VARCHAR(200), city VARCHAR(200), region VARCHAR(200), zip VARCHAR(20), avatar_url VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_alibaba (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_argep (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_arukereso (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), address VARCHAR(200), website VARCHAR(200), facebook text, country VARCHAR(2), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_auto_scout24 (id BIGINT AUTO_INCREMENT, external_id BIGINT, name VARCHAR(200), page_id text, avatar_url VARCHAR(200), country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_bookatable (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_capterra (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), website VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_checkatrade (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, city VARCHAR(200), region VARCHAR(200), zip VARCHAR(20), avatar_url VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_easyweddings (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, avatar_url VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_fresha (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_mobilede (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_opentable (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_patient_connect365 (id BIGINT AUTO_INCREMENT, external_id BIGINT, name VARCHAR(200), page_id text, city VARCHAR(100), zip VARCHAR(10), address VARCHAR(200), state VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX external_id_unique_idx (external_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_pricespy (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, avatar_url VARCHAR(200), website VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_provenexpert (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_realself (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_reco (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_reviewsio (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), website VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_sitejabber (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_sourceforge (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_tandlakare (id BIGINT AUTO_INCREMENT, external_id BIGINT, name VARCHAR(200), page_id text, city VARCHAR(100), zip VARCHAR(10), address VARCHAR(200), region VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX external_id_unique_idx (external_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_tripadvisor (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_trustatrader (id BIGINT AUTO_INCREMENT, external_id BIGINT, name VARCHAR(200), page_id text, city VARCHAR(100), zip VARCHAR(10), address VARCHAR(200), region VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX external_id_unique_idx (external_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_trustpilot (id BIGINT AUTO_INCREMENT, name VARCHAR(200), category VARCHAR(100), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_trustratings (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_vardense (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_whichtrustedtraders (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, street VARCHAR(200), city VARCHAR(200), region VARCHAR(200), zip VARCHAR(20), avatar_url VARCHAR(200), website VARCHAR(200), phone VARCHAR(200), email VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_wordpress_plugin (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, avatar_url VARCHAR(200), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_zillow (id BIGINT AUTO_INCREMENT, name VARCHAR(100), page_id text, address VARCHAR(200), website VARCHAR(200), facebook text, email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_partners_zoover (id BIGINT AUTO_INCREMENT, name VARCHAR(200), page_id text, country VARCHAR(2), city VARCHAR(100), zip VARCHAR(20), address VARCHAR(200), website VARCHAR(200), email VARCHAR(200), phone VARCHAR(200), subscription_id BIGINT, is_wordpress TINYINT(1), platform VARCHAR(20), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE source_url (id BIGINT AUTO_INCREMENT, type VARCHAR(25) DEFAULT 'Google' NOT NULL, page_id VARCHAR(255), write_review_url TEXT, UNIQUE INDEX page_id_type_idx_idx (page_id, type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE stat_trustindex_review_weekly (id BIGINT AUTO_INCREMENT, date DATE, company_using_new BIGINT, company_using_total BIGINT, reviews_new BIGINT, reviews_total BIGINT, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE stat_widget_feed_wordpress_view_daily (id BIGINT AUTO_INCREMENT, date DATE, source_feed_wordpress_id BIGINT, viewed MEDIUMINT UNSIGNED, INDEX source_feed_wordpress_id_idx (source_feed_wordpress_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE stat_widget_parameters_daily (id BIGINT AUTO_INCREMENT, widget_type VARCHAR(100), parameter_group VARCHAR(200), parameter_name VARCHAR(200), package VARCHAR(10) DEFAULT 'free' NOT NULL, number BIGINT, date DATE, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE stat_widget_referer (id BIGINT AUTO_INCREMENT, widget_id BIGINT, domain VARCHAR(100), url VARCHAR(200), INDEX widget_id_idx (widget_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE stat_widget_view_daily (id BIGINT AUTO_INCREMENT, date DATE, widget_id BIGINT, viewed SMALLINT UNSIGNED, INDEX widget_id_idx (widget_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE stat_widget_view_weekly (id BIGINT AUTO_INCREMENT, week_number TINYINT, widget_id BIGINT, viewed MEDIUMINT UNSIGNED, INDEX widget_id_idx (widget_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE stat_wp_info (id BIGINT AUTO_INCREMENT, type VARCHAR(10) DEFAULT 'noreg' NOT NULL, domain VARCHAR(100), current_theme LONGTEXT, themes LONGTEXT, plugins LONGTEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE subscription (id BIGINT AUTO_INCREMENT, vat_id VARCHAR(20), is_eu_vat_id TINYINT(1) DEFAULT '0', name VARCHAR(100), country VARCHAR(3), zip VARCHAR(14), city VARCHAR(50), address VARCHAR(100), invoicing_email VARCHAR(100), invoice_language VARCHAR(2) DEFAULT 'en' NOT NULL, need_invoice TINYINT(1) DEFAULT '1', package VARCHAR(10) DEFAULT 'trial' NOT NULL, package_price SMALLINT, package_currency VARCHAR(3) DEFAULT 'USD' NOT NULL, package_discount VARCHAR(12), stripe_customer_id VARCHAR(50), stripe_canceled_at DATE, paypal_subscription_id VARCHAR(50), invitation_number SMALLINT DEFAULT 0, validity_date DATE, agent_id VARCHAR(10), campaign_id VARCHAR(20), tmp_limited_at DATE, tmp_limited_step VARCHAR(10), tmp_checked_at DATE, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX agent_id_idx (agent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE subscription_event (id BIGINT AUTO_INCREMENT, subscription_id BIGINT, user_id BIGINT, company_id BIGINT, type VARCHAR(20) NOT NULL COLLATE utf8mb4_general_ci, comment LONGTEXT COLLATE utf8mb4_general_ci, created_at DATETIME NOT NULL, INDEX company_id_idx (company_id), INDEX subscription_id_idx (subscription_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE subscription_service (id BIGINT AUTO_INCREMENT, company_id BIGINT, subscription_id BIGINT, type VARCHAR(20) NOT NULL, validity_date datetime, price DOUBLE(8, 2), price_first DOUBLE(8, 2), currency VARCHAR(3) DEFAULT 'USD' NOT NULL, details LONGTEXT, discount VARCHAR(12), payment_method VARCHAR(20) DEFAULT 'PayPal' NOT NULL, payment_gateway_subscription_id VARCHAR(50), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX subscription_id_idx (subscription_id), INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE third_party_account (id BIGINT AUTO_INCREMENT, user_id VARCHAR(200), type VARCHAR(25), name TEXT, refresh_token TEXT, access_token TEXT, company_id BIGINT, source_location_relation LONGTEXT, invite_id BIGINT, feed_invite_id BIGINT, expires_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX user_id_by_type_unique_idx (user_id, type, company_id), INDEX company_id_idx (company_id), INDEX invite_id_idx (invite_id), INDEX feed_invite_id_idx (feed_invite_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE validated_certificate (id BIGINT AUTO_INCREMENT, value LONGTEXT, type VARCHAR(20) DEFAULT 'google' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE validated_smtp (id BIGINT AUTO_INCREMENT, company_id BIGINT, email VARCHAR(200), server VARCHAR(200), port MEDIUMINT, encryption VARCHAR(10) DEFAULT NULL, username VARCHAR(200), password VARCHAR(128), error LONGTEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE validated_spf (id BIGINT AUTO_INCREMENT, company_id BIGINT, email VARCHAR(200), error LONGTEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE widget (id BIGINT AUTO_INCREMENT, company_id BIGINT, name VARCHAR(100), language VARCHAR(4) DEFAULT 'en' NOT NULL, link_follow TINYINT(1) DEFAULT '1', footer_link_url text, footer_link_text VARCHAR(100), widget_layout_id BIGINT, color_schema VARCHAR(100), size_name TINYINT DEFAULT 14, date_format_id TINYINT DEFAULT 1, name_format_id TINYINT DEFAULT 1, width VARCHAR(6) DEFAULT '100%', copyright TINYINT(1) DEFAULT '1', params LONGTEXT COLLATE utf8mb4_general_ci, photo_url TEXT, photo_sprite TINYINT(1) DEFAULT '0', photo_sprite_urls LONGTEXT, filter_language VARCHAR(2) DEFAULT '' NOT NULL, filter_ratings LONGTEXT, filter_tags LONGTEXT, filter_min_length SMALLINT UNSIGNED DEFAULT 1, filter_max_length SMALLINT UNSIGNED, filter_source_types LONGTEXT, filter_order VARCHAR(20) DEFAULT 'newer_sooner' NOT NULL, slider_rotate_sec TINYINT UNSIGNED DEFAULT 6, num_reviews TINYINT UNSIGNED DEFAULT 10, refresh_days TINYINT UNSIGNED DEFAULT 1, has_rich_snippets TINYINT(1) DEFAULT '0', selected_source_ids LONGTEXT, is_limited TINYINT(1) DEFAULT '0', error LONGTEXT, error_at datetime, checked_at datetime, generated_at datetime, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX company_id_idx (company_id), INDEX widget_layout_id_idx (widget_layout_id), INDEX date_format_id_idx (date_format_id), INDEX name_format_id_idx (name_format_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE widget_click (id BIGINT AUTO_INCREMENT, widget_id BIGINT, ip VARCHAR(45), created_at DATETIME NOT NULL, INDEX widget_id_idx (widget_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE widget_layout (id BIGINT AUTO_INCREMENT, name VARCHAR(100), type VARCHAR(20) DEFAULT 'signature' NOT NULL, params LONGTEXT, fields LONGTEXT, category VARCHAR(100), is_active TINYINT(1) DEFAULT '1', is_wordpress TINYINT(1) DEFAULT '1', is_admin TINYINT(1) DEFAULT '1', is_popular TINYINT(1) DEFAULT '0', position SMALLINT, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE wix (id BIGINT AUTO_INCREMENT, owner_id VARCHAR(100), instance_id VARCHAR(100), params LONGTEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE wordpress_comparison (id BIGINT AUTO_INCREMENT, slug VARCHAR(200), stat LONGTEXT, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE wordpress_login (id BIGINT AUTO_INCREMENT, username VARCHAR(50), password VARCHAR(50), login_url VARCHAR(250), cookie text, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE wordpress_position (id BIGINT AUTO_INCREMENT, term VARCHAR(200), positions LONGTEXT, comment VARCHAR(200), created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_forgot_password (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, unique_key VARCHAR(255), expires_at DATETIME NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_group (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_group_permission (group_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(group_id, permission_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_permission (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_remember_key (id BIGINT AUTO_INCREMENT, user_id BIGINT, remember_key VARCHAR(32), ip_address VARCHAR(50), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_user (id BIGINT AUTO_INCREMENT, first_name VARCHAR(255), last_name VARCHAR(255), email_address VARCHAR(255) NOT NULL UNIQUE, username VARCHAR(128) NOT NULL UNIQUE, algorithm VARCHAR(128) DEFAULT 'sha1' NOT NULL, salt VARCHAR(128), password VARCHAR(128), is_active TINYINT(1) DEFAULT '1', is_super_admin TINYINT(1) DEFAULT '0', last_login DATETIME, g2fa VARCHAR(32), last_login_ip VARCHAR(45), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_active_idx_idx (is_active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_user_group (user_id BIGINT, group_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
CREATE TABLE sf_guard_user_permission (user_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, permission_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;
ALTER TABLE agent_profile ADD CONSTRAINT agent_profile_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE async_process ADD CONSTRAINT async_process_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE async_process ADD CONSTRAINT async_process_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE async_process_brightdata ADD CONSTRAINT async_process_brightdata_aspr_id_async_process_page_request_id FOREIGN KEY (aspr_id) REFERENCES async_process_page_request(id) ON DELETE CASCADE;
ALTER TABLE async_process_datashake ADD CONSTRAINT async_process_datashake_aspr_id_async_process_page_request_id FOREIGN KEY (aspr_id) REFERENCES async_process_page_request(id) ON DELETE CASCADE;
ALTER TABLE campaign_queue ADD CONSTRAINT campaign_queue_mail_id_campaign_mail_id FOREIGN KEY (mail_id) REFERENCES campaign_mail(id) ON DELETE SET NULL;
ALTER TABLE company ADD CONSTRAINT company_company_category_id_company_category_id FOREIGN KEY (company_category_id) REFERENCES company_category(id) ON DELETE SET NULL;
ALTER TABLE company_account_handler_subscription_relation ADD CONSTRAINT ccci FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_account_handler_subscription_relation ADD CONSTRAINT casi FOREIGN KEY (account_handler_subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE company_address ADD CONSTRAINT company_address_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_ai_settings ADD CONSTRAINT company_ai_settings_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_category ADD CONSTRAINT FK_1EDB0CAC727ACA70 FOREIGN KEY (parent_id) REFERENCES company_category(id) ON DELETE SET NULL;
ALTER TABLE company_change ADD CONSTRAINT company_change_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_company_category ADD CONSTRAINT company_company_category_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_company_category ADD CONSTRAINT company_company_category_company_category_id_company_category_id FOREIGN KEY (company_category_id) REFERENCES company_category(id) ON DELETE CASCADE;
ALTER TABLE company_offer ADD CONSTRAINT company_offer_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_offer_click ADD CONSTRAINT company_offer_click_company_offer_id_company_offer_id FOREIGN KEY (company_offer_id) REFERENCES company_offer(id) ON DELETE CASCADE;
ALTER TABLE company_offer_view ADD CONSTRAINT company_offer_view_company_offer_id_company_offer_id FOREIGN KEY (company_offer_id) REFERENCES company_offer(id) ON DELETE CASCADE;
ALTER TABLE company_subscription_relation ADD CONSTRAINT company_subscription_relation_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE company_subscription_relation ADD CONSTRAINT company_subscription_relation_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_summary ADD CONSTRAINT company_summary_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_translation ADD CONSTRAINT company_translation_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE company_user_relation ADD CONSTRAINT company_user_relation_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE company_user_relation ADD CONSTRAINT company_user_relation_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE email_status ADD CONSTRAINT email_status_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE integration ADD CONSTRAINT integration_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE integration ADD CONSTRAINT integration_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE mail_sent ADD CONSTRAINT mail_sent_mail_id_mail_id FOREIGN KEY (mail_id) REFERENCES mail(id) ON DELETE CASCADE;
ALTER TABLE marketing_campaign_event ADD CONSTRAINT mmmi FOREIGN KEY (marketing_campaign_id) REFERENCES marketing_campaign(id) ON DELETE CASCADE;
ALTER TABLE marketing_campaign_event ADD CONSTRAINT marketing_campaign_event_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE marketing_campaign_subscription_relation ADD CONSTRAINT mssi FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE marketing_campaign_subscription_relation ADD CONSTRAINT mmmi_1 FOREIGN KEY (marketing_campaign_id) REFERENCES marketing_campaign(id) ON DELETE CASCADE;
ALTER TABLE payment ADD CONSTRAINT payment_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE SET NULL;
ALTER TABLE payment ADD CONSTRAINT payment_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE SET NULL;
ALTER TABLE payment_dispute ADD CONSTRAINT payment_dispute_payment_id_payment_id FOREIGN KEY (payment_id) REFERENCES payment(id) ON DELETE CASCADE;
ALTER TABLE product ADD CONSTRAINT product_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE product_order_product_relation ADD CONSTRAINT product_order_product_relation_product_order_id_product_order_id FOREIGN KEY (product_order_id) REFERENCES product_order(id) ON DELETE CASCADE;
ALTER TABLE product_order_product_relation ADD CONSTRAINT product_order_product_relation_product_id_product_id FOREIGN KEY (product_id) REFERENCES product(id) ON DELETE CASCADE;
ALTER TABLE product_order_product_relation ADD CONSTRAINT pppi_1 FOREIGN KEY (product_variant_price_id) REFERENCES product_variant_price(id) ON DELETE CASCADE;
ALTER TABLE product_order_product_relation ADD CONSTRAINT pppi FOREIGN KEY (product_variant_id) REFERENCES product_variant(id) ON DELETE CASCADE;
ALTER TABLE product_review ADD CONSTRAINT product_review_product_order_id_product_order_id FOREIGN KEY (product_order_id) REFERENCES product_order(id) ON DELETE CASCADE;
ALTER TABLE product_review ADD CONSTRAINT product_review_product_id_product_id FOREIGN KEY (product_id) REFERENCES product(id) ON DELETE CASCADE;
ALTER TABLE product_variant ADD CONSTRAINT product_variant_product_id_product_id FOREIGN KEY (product_id) REFERENCES product(id) ON DELETE CASCADE;
ALTER TABLE product_variant_price ADD CONSTRAINT product_variant_price_product_variant_id_product_variant_id FOREIGN KEY (product_variant_id) REFERENCES product_variant(id) ON DELETE CASCADE;
ALTER TABLE profile ADD CONSTRAINT profile_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE profile_analysis ADD CONSTRAINT profile_analysis_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE SET NULL;
ALTER TABLE profile_analysis ADD CONSTRAINT profile_analysis_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE profile_analysis_attribute ADD CONSTRAINT profile_analysis_attribute_analysis_id_profile_analysis_id FOREIGN KEY (analysis_id) REFERENCES profile_analysis(id) ON DELETE CASCADE;
ALTER TABLE profile_analysis_attribute ADD CONSTRAINT papi FOREIGN KEY (analysis_attribute_info_id) REFERENCES profile_analysis_attribute_info(id) ON DELETE CASCADE;
ALTER TABLE profile_analysis_log ADD CONSTRAINT profile_analysis_log_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE SET NULL;
ALTER TABLE profile_analysis_log ADD CONSTRAINT profile_analysis_log_analysis_id_profile_analysis_id FOREIGN KEY (analysis_id) REFERENCES profile_analysis(id) ON DELETE CASCADE;
ALTER TABLE profile_social_platform ADD CONSTRAINT profile_social_platform_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE public_html_generate ADD CONSTRAINT public_html_generate_reviewer_id_reviewer_id FOREIGN KEY (reviewer_id) REFERENCES reviewer(id) ON DELETE CASCADE;
ALTER TABLE public_html_generate ADD CONSTRAINT public_html_generate_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE ranking_process ADD CONSTRAINT ranking_process_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE SET NULL;
ALTER TABLE ranking_process ADD CONSTRAINT ranking_process_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE ranking_result ADD CONSTRAINT ranking_result_ranking_process_id_ranking_process_id FOREIGN KEY (ranking_process_id) REFERENCES ranking_process(id) ON DELETE CASCADE;
ALTER TABLE recommendation ADD CONSTRAINT recommendation_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE SET NULL;
ALTER TABLE review ADD CONSTRAINT review_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE review_invite ADD CONSTRAINT rrri FOREIGN KEY (review_invite_campaign_id) REFERENCES review_invite_campaign(id) ON DELETE CASCADE;
ALTER TABLE review_invite_campaign ADD CONSTRAINT review_invite_campaign_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE review_invite_campaign ADD CONSTRAINT review_invite_campaign_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE review_invite_cancellation ADD CONSTRAINT review_invite_cancellation_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE review_invite_card ADD CONSTRAINT review_invite_card_payment_id_payment_id FOREIGN KEY (payment_id) REFERENCES payment(id) ON DELETE SET NULL;
ALTER TABLE review_invite_card ADD CONSTRAINT review_invite_card_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE SET NULL;
ALTER TABLE review_invite_card_view ADD CONSTRAINT rrri_1 FOREIGN KEY (review_invite_card_id) REFERENCES review_invite_card(id) ON DELETE CASCADE;
ALTER TABLE review_like ADD CONSTRAINT review_like_reviewer_id_reviewer_id FOREIGN KEY (reviewer_id) REFERENCES reviewer(id) ON DELETE SET NULL;
ALTER TABLE review_like ADD CONSTRAINT review_like_review_id_review_id FOREIGN KEY (review_id) REFERENCES review(id) ON DELETE CASCADE;
ALTER TABLE review_reply_ai ADD CONSTRAINT review_reply_ai_review_id_review_id FOREIGN KEY (review_id) REFERENCES review(id) ON DELETE CASCADE;
ALTER TABLE review_reply_ai ADD CONSTRAINT review_reply_ai_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE SET NULL;
ALTER TABLE review_review_tag_relation ADD CONSTRAINT review_review_tag_relation_review_tag_id_review_tag_id FOREIGN KEY (review_tag_id) REFERENCES review_tag(id) ON DELETE CASCADE;
ALTER TABLE review_review_tag_relation ADD CONSTRAINT review_review_tag_relation_review_id_review_id FOREIGN KEY (review_id) REFERENCES review(id) ON DELETE CASCADE;
ALTER TABLE review_spam_log ADD CONSTRAINT review_spam_log_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE review_spam_report ADD CONSTRAINT review_spam_report_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE SET NULL;
ALTER TABLE review_spam_report ADD CONSTRAINT review_spam_report_review_id_review_id FOREIGN KEY (review_id) REFERENCES review(id) ON DELETE CASCADE;
ALTER TABLE review_spam_report ADD CONSTRAINT review_spam_report_public_user_id_reviewer_id FOREIGN KEY (public_user_id) REFERENCES reviewer(id) ON DELETE SET NULL;
ALTER TABLE review_spammer ADD CONSTRAINT review_spammer_reviewer_id_reviewer_id FOREIGN KEY (reviewer_id) REFERENCES reviewer(id) ON DELETE CASCADE;
ALTER TABLE review_spammer_company ADD CONSTRAINT review_spammer_company_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE review_tag ADD CONSTRAINT review_tag_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE review_translation ADD CONSTRAINT review_translation_review_id_review_id FOREIGN KEY (review_id) REFERENCES review(id) ON DELETE CASCADE;
ALTER TABLE service_question ADD CONSTRAINT service_question_reviewer_id_reviewer_id FOREIGN KEY (reviewer_id) REFERENCES reviewer(id) ON DELETE CASCADE;
ALTER TABLE service_question ADD CONSTRAINT service_question_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE service_question_answer ADD CONSTRAINT service_question_answer_service_question_id_service_question_id FOREIGN KEY (service_question_id) REFERENCES service_question(id) ON DELETE CASCADE;
ALTER TABLE service_question_answer ADD CONSTRAINT service_question_answer_reviewer_id_reviewer_id FOREIGN KEY (reviewer_id) REFERENCES reviewer(id) ON DELETE CASCADE;
ALTER TABLE service_question_answer_like ADD CONSTRAINT sssi FOREIGN KEY (service_question_answer_id) REFERENCES service_question_answer(id) ON DELETE CASCADE;
ALTER TABLE service_question_answer_like ADD CONSTRAINT service_question_answer_like_reviewer_id_reviewer_id FOREIGN KEY (reviewer_id) REFERENCES reviewer(id) ON DELETE SET NULL;
ALTER TABLE service_question_spam_report ADD CONSTRAINT sssi_1 FOREIGN KEY (service_question_id) REFERENCES service_question(id) ON DELETE CASCADE;
ALTER TABLE service_question_spam_report ADD CONSTRAINT service_question_spam_report_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE SET NULL;
ALTER TABLE source ADD CONSTRAINT source_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE source_brightdata ADD CONSTRAINT source_brightdata_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE source_datashake ADD CONSTRAINT source_datashake_source_id_source_id FOREIGN KEY (source_id) REFERENCES source(id) ON DELETE CASCADE;
ALTER TABLE source_feed ADD CONSTRAINT source_feed_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE source_feed_invite ADD CONSTRAINT source_feed_invite_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE source_invite ADD CONSTRAINT source_invite_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE stat_widget_feed_wordpress_view_daily ADD CONSTRAINT sssi_2 FOREIGN KEY (source_feed_wordpress_id) REFERENCES source_feed_wordpress(id) ON DELETE CASCADE;
ALTER TABLE stat_widget_referer ADD CONSTRAINT stat_widget_referer_widget_id_widget_id FOREIGN KEY (widget_id) REFERENCES widget(id) ON DELETE CASCADE;
ALTER TABLE stat_widget_view_daily ADD CONSTRAINT stat_widget_view_daily_widget_id_widget_id FOREIGN KEY (widget_id) REFERENCES widget(id) ON DELETE CASCADE;
ALTER TABLE stat_widget_view_weekly ADD CONSTRAINT stat_widget_view_weekly_widget_id_widget_id FOREIGN KEY (widget_id) REFERENCES widget(id) ON DELETE CASCADE;
ALTER TABLE subscription_event ADD CONSTRAINT subscription_event_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE SET NULL;
ALTER TABLE subscription_event ADD CONSTRAINT subscription_event_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE subscription_event ADD CONSTRAINT subscription_event_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE SET NULL;
ALTER TABLE subscription_service ADD CONSTRAINT subscription_service_subscription_id_subscription_id FOREIGN KEY (subscription_id) REFERENCES subscription(id) ON DELETE CASCADE;
ALTER TABLE subscription_service ADD CONSTRAINT subscription_service_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE third_party_account ADD CONSTRAINT third_party_account_invite_id_source_invite_id FOREIGN KEY (invite_id) REFERENCES source_invite(id) ON DELETE SET NULL;
ALTER TABLE third_party_account ADD CONSTRAINT third_party_account_feed_invite_id_source_feed_invite_id FOREIGN KEY (feed_invite_id) REFERENCES source_feed_invite(id) ON DELETE SET NULL;
ALTER TABLE third_party_account ADD CONSTRAINT third_party_account_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE SET NULL;
ALTER TABLE validated_smtp ADD CONSTRAINT validated_smtp_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE validated_spf ADD CONSTRAINT validated_spf_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE widget ADD CONSTRAINT widget_widget_layout_id_widget_layout_id FOREIGN KEY (widget_layout_id) REFERENCES widget_layout(id) ON DELETE SET NULL;
ALTER TABLE widget ADD CONSTRAINT widget_name_format_id_name_format_id FOREIGN KEY (name_format_id) REFERENCES name_format(id) ON DELETE SET NULL;
ALTER TABLE widget ADD CONSTRAINT widget_date_format_id_date_format_id FOREIGN KEY (date_format_id) REFERENCES date_format(id) ON DELETE SET NULL;
ALTER TABLE widget ADD CONSTRAINT widget_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE;
ALTER TABLE widget_click ADD CONSTRAINT widget_click_widget_id_widget_id FOREIGN KEY (widget_id) REFERENCES widget(id) ON DELETE SET NULL;
ALTER TABLE sf_guard_forgot_password ADD CONSTRAINT sf_guard_forgot_password_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_remember_key ADD CONSTRAINT sf_guard_remember_key_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;
