Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::get_table_creation_sql()publicWC 1.0

Get the SQL statement that creates the product attributes lookup table, including the indices.

Method of the class: DataRegenerator{}

No Hooks.

Return

String.

Usage

$DataRegenerator = new DataRegenerator();
$DataRegenerator->get_table_creation_sql();

DataRegenerator::get_table_creation_sql() code WC 8.6.1

public function get_table_creation_sql() {
	global $wpdb;

	$collate = $wpdb->has_cap( 'collation' ) ? $wpdb->get_charset_collate() : '';

	return "CREATE TABLE {$this->lookup_table_name} (
 product_id bigint(20) NOT NULL,
 product_or_parent_id bigint(20) NOT NULL,
 taxonomy varchar(32) NOT NULL,
 term_id bigint(20) NOT NULL,
 is_variation_attribute tinyint(1) NOT NULL,
 in_stock tinyint(1) NOT NULL,
 INDEX is_variation_attribute_term_id (is_variation_attribute, term_id),
 PRIMARY KEY  ( `product_or_parent_id`, `term_id`, `product_id`, `taxonomy` )
) $collate;";
}