Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::create_table_primary_index()publicWC 1.0

Create the primary key for the table if it doesn't exist already. It also deletes the product_or_parent_id_term_id index if it exists, since it's now redundant.

{} Это метод класса: DataRegenerator{}

Хуков нет.

Возвращает

null. Ничего.

Использование

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

Код DataRegenerator::create_table_primary_index() WC 6.8.0

public function create_table_primary_index() {
	$database_util = wc_get_container()->get( DatabaseUtil::class );
	$database_util->create_primary_key( $this->lookup_table_name, array( 'product_or_parent_id', 'term_id', 'product_id', 'taxonomy' ) );
	$database_util->drop_table_index( $this->lookup_table_name, 'product_or_parent_id_term_id' );

	if ( empty( $database_util->get_index_columns( $this->lookup_table_name ) ) ) {
		wc_get_logger()->error( "The creation of the primary key for the {$this->lookup_table_name} table failed" );
	}

	if ( ! empty( $database_util->get_index_columns( $this->lookup_table_name, 'product_or_parent_id_term_id' ) ) ) {
		wc_get_logger()->error( "Dropping the product_or_parent_id_term_id index from the {$this->lookup_table_name} table failed" );
	}
}