DataSynchronizer::create_database_tables()publicWC 1.0

Create the custom orders database tables and log an error if that's not possible.

Method of the class: DataSynchronizer{}

No Hooks.


true|false. True if all the tables were successfully created, false otherwise.


$DataSynchronizer = new DataSynchronizer();

DataSynchronizer::create_database_tables() code WC 8.9.0

public function create_database_tables() {
	$this->database_util->dbdelta( $this->data_store->get_database_schema() );
	$success = $this->check_orders_table_exists();
	if ( ! $success ) {
		$missing_tables = $this->database_util->get_missing_tables( $this->data_store->get_database_schema() );
		$missing_tables = implode( ', ', $missing_tables );
		$this->error_logger->error( "HPOS tables are missing in the database and couldn't be created. The missing tables are: $missing_tables" );
	return $success;