CREATE TABLE IF NOT EXISTS tw_supplier_product(
    id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    product_id bigint(20) unsigned NOT NULL,
    variation_id int(10) DEFAULT NULL,
    supplier_name varchar(500) NOT NULL,
    restocking_delay int(3) DEFAULT NULL,
    manage_restocking tinyint(1) DEFAULT 0,
    supplier_restocking_url varchar(500) DEFAULT NULL,
    FOREIGN KEY (product_id) REFERENCES wp_posts(ID),
    PRIMARY KEY (id)
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS tw_delivery_product(
    id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    product_id bigint(20) unsigned NOT NULL,
    delivery_instance_id bigint(20) unsigned NOT NULL,
    FOREIGN KEY (product_id) REFERENCES wp_posts(ID),
    PRIMARY KEY (id)
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS tw_variable_product(
    id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    product_id bigint(20) unsigned NOT NULL,
    target_product_id bigint(20) unsigned NOT NULL,
    FOREIGN KEY (product_id) REFERENCES wp_posts(ID),
    FOREIGN KEY (target_product_id) REFERENCES wp_posts(ID),
    PRIMARY KEY (id)
) ENGINE = INNODB;

update wp_options set option_value = 'no' where option_name = 'woocommerce_enable_coupons';
update wp_options set option_value = 'yes' where option_name = 'woocommerce_enable_guest_checkout';
update wp_options set option_value = 'yes' where option_name = 'woocommerce_enable_signup_and_login_from_checkout';
update wp_options set option_value = 'yes' where option_name = 'woocommerce_registration_generate_password';