WC_Install::get_order_stats_table_schema
Get the wc_order_stats table schema.
Метод класса: WC_Install{}
Хуков нет.
Возвращает
Строку. SQL schema for wc_order_stats table.
Использование
$result = WC_Install::get_order_stats_table_schema( $collate );
- $collate(строка) (обязательный)
- Database collation.
Список изменений
| С версии 10.4.0 | Введена. |
Код WC_Install::get_order_stats_table_schema() WC Install::get order stats table schema WC 10.4.3
private static function get_order_stats_table_schema( $collate ) {
global $wpdb;
$should_have_fulfillment_column = self::is_new_install() && FeaturesUtil::feature_is_enabled( 'fulfillments' );
if ( false === $should_have_fulfillment_column ) {
$should_have_fulfillment_column = OrdersStatsDataStore::has_fulfillment_status_column();
}
return "CREATE TABLE {$wpdb->prefix}wc_order_stats (
order_id bigint(20) unsigned NOT NULL,
parent_id bigint(20) unsigned DEFAULT 0 NOT NULL,
date_created datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
date_created_gmt datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
date_paid datetime DEFAULT '0000-00-00 00:00:00',
date_completed datetime DEFAULT '0000-00-00 00:00:00',
num_items_sold int(11) DEFAULT 0 NOT NULL,
total_sales double DEFAULT 0 NOT NULL,
tax_total double DEFAULT 0 NOT NULL,
shipping_total double DEFAULT 0 NOT NULL,
net_total double DEFAULT 0 NOT NULL,
returning_customer tinyint(1) DEFAULT NULL,
status varchar(20) NOT NULL,
customer_id bigint(20) unsigned NOT NULL" .
( $should_have_fulfillment_column ? ',
fulfillment_status varchar(50) DEFAULT NULL' : '' ) . ',
PRIMARY KEY (order_id),
KEY date_created (date_created),
KEY customer_id (customer_id),
KEY status (status)' .
( $should_have_fulfillment_column ? ',
KEY fulfillment_status (fulfillment_status)' : '' ) . ",
KEY idx_date_paid_status_parent (date_paid, status, parent_id)
) $collate;";
}