2022-11-27 15:03:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Orders Schema Class.
|
|
|
|
*
|
|
|
|
* @package EDD
|
|
|
|
* @subpackage Database\Schemas
|
|
|
|
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
|
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
|
|
|
* @since 3.0
|
|
|
|
*/
|
2023-06-05 11:21:17 +00:00
|
|
|
|
2022-11-27 15:03:07 +00:00
|
|
|
namespace EDD\Database\Schemas;
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// Exit if accessed directly.
|
2022-11-27 15:03:07 +00:00
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
use EDD\Database\Schema;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Orders Schema Class.
|
|
|
|
*
|
|
|
|
* @since 3.0
|
|
|
|
*/
|
|
|
|
class Orders extends Schema {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Array of database column objects.
|
|
|
|
*
|
|
|
|
* @since 3.0
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $columns = array(
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// id.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'id',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
|
|
|
'extra' => 'auto_increment',
|
|
|
|
'primary' => true,
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// parent.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'parent',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// order_number.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'order_number',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '255',
|
|
|
|
'searchable' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// status.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'status',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
|
|
|
'default' => 'pending',
|
|
|
|
'sortable' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'transition' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// type.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'type',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
|
|
|
'default' => 'sale',
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// user_id.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'user_id',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// customer_id.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'customer_id',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// email.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'email',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '100',
|
|
|
|
'searchable' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// ip.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'ip',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '60',
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// gateway.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'gateway',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '100',
|
|
|
|
'sortable' => true,
|
|
|
|
'default' => 'manual',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// mode.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'mode',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// currency.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'currency',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
|
|
|
'validate' => 'strtoupper',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// payment_key.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'payment_key',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '64',
|
|
|
|
'searchable' => true,
|
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// tax_rate_id.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'tax_rate_id',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
|
|
|
'default' => null,
|
|
|
|
'allow_null' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// subtotal.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'subtotal',
|
|
|
|
'type' => 'decimal',
|
|
|
|
'length' => '18,9',
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
|
|
|
'validate' => 'edd_sanitize_amount',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// discount.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'discount',
|
|
|
|
'type' => 'decimal',
|
|
|
|
'length' => '18,9',
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
|
|
|
'validate' => 'edd_sanitize_amount',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// tax.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'tax',
|
|
|
|
'type' => 'decimal',
|
|
|
|
'length' => '18,9',
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
|
|
|
'validate' => 'edd_sanitize_amount',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// total.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'total',
|
|
|
|
'type' => 'decimal',
|
|
|
|
'length' => '18,9',
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
|
|
|
'validate' => 'edd_sanitize_amount',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// rate.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'name' => 'rate',
|
|
|
|
'type' => 'decimal',
|
|
|
|
'length' => '10,5',
|
|
|
|
'default' => '1.00000',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// date_created.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'date_created',
|
|
|
|
'type' => 'datetime',
|
2023-06-05 11:21:17 +00:00
|
|
|
'default' => '', // Defaults to current time in query class.
|
2022-11-27 15:03:07 +00:00
|
|
|
'created' => true,
|
|
|
|
'date_query' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// date_modified.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'date_modified',
|
|
|
|
'type' => 'datetime',
|
2023-06-05 11:21:17 +00:00
|
|
|
'default' => '', // Defaults to current time in query class.
|
2022-11-27 15:03:07 +00:00
|
|
|
'modified' => true,
|
|
|
|
'date_query' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// date_completed.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'date_completed',
|
|
|
|
'type' => 'datetime',
|
|
|
|
'default' => null,
|
|
|
|
'allow_null' => true,
|
|
|
|
'date_query' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// date_refundable.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'date_refundable',
|
|
|
|
'type' => 'datetime',
|
|
|
|
'default' => null,
|
|
|
|
'allow_null' => true,
|
|
|
|
'date_query' => true,
|
2023-06-05 11:21:17 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-06-05 11:21:17 +00:00
|
|
|
// uuid.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-06-05 11:21:17 +00:00
|
|
|
'uuid' => true,
|
|
|
|
),
|
2022-11-27 15:03:07 +00:00
|
|
|
);
|
|
|
|
}
|