2022-11-27 15:03:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Adjustments 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-01-18 16:39:57 +00:00
|
|
|
|
2022-11-27 15:03:07 +00:00
|
|
|
namespace EDD\Database\Schemas;
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// Exit if accessed directly.
|
2022-11-27 15:03:07 +00:00
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
use EDD\Database\Schema;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adjustments Schema Class.
|
|
|
|
*
|
|
|
|
* @since 3.0
|
|
|
|
*/
|
|
|
|
final class Adjustments extends Schema {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Array of database column objects.
|
|
|
|
*
|
|
|
|
* @since 3.0
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $columns = array(
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// id.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-01-18 16:39:57 +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-01-18 16:39:57 +00:00
|
|
|
// parent.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'parent',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'transition' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// name.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'name',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '200',
|
|
|
|
'searchable' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// code.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'code',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '50',
|
|
|
|
'searchable' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'sortable' => true,
|
|
|
|
'cache_key' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// status.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'status',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
|
|
|
'default' => 'draft',
|
|
|
|
'sortable' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'transition' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
// type
|
|
|
|
array(
|
|
|
|
'name' => 'type',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
|
|
|
'default' => '',
|
|
|
|
'sortable' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'transition' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// scope.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'scope',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
|
|
|
'default' => '',
|
|
|
|
'sortable' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'transition' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// amount_type.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'amount_type',
|
|
|
|
'type' => 'varchar',
|
|
|
|
'length' => '20',
|
|
|
|
'default' => '',
|
|
|
|
'sortable' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'transition' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// amount.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-01-18 16:39:57 +00:00
|
|
|
'name' => 'amount',
|
|
|
|
'type' => 'decimal',
|
|
|
|
'length' => '18,9',
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// description.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'description',
|
|
|
|
'type' => 'longtext',
|
|
|
|
'default' => '',
|
2023-01-18 16:39:57 +00:00
|
|
|
'searchable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// max_uses.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'max_uses',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'default' => '0',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// use_count.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-01-18 16:39:57 +00:00
|
|
|
'name' => 'use_count',
|
|
|
|
'type' => 'bigint',
|
|
|
|
'length' => '20',
|
|
|
|
'unsigned' => true,
|
|
|
|
'default' => '0',
|
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// once_per_customer.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-01-18 16:39:57 +00:00
|
|
|
'name' => 'once_per_customer',
|
|
|
|
'type' => 'int',
|
|
|
|
'length' => '1',
|
|
|
|
'default' => '0',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// min_charge_amount.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-01-18 16:39:57 +00:00
|
|
|
'name' => 'min_charge_amount',
|
|
|
|
'type' => 'decimal',
|
|
|
|
'length' => '18,9',
|
|
|
|
'default' => '0',
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// start_date.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'start_date',
|
|
|
|
'type' => 'datetime',
|
|
|
|
'default' => null,
|
|
|
|
'allow_null' => true,
|
|
|
|
'date_query' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// end_date.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'end_date',
|
|
|
|
'type' => 'datetime',
|
|
|
|
'default' => null,
|
|
|
|
'allow_null' => true,
|
|
|
|
'date_query' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// date_created.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'date_created',
|
|
|
|
'type' => 'datetime',
|
2023-01-18 16:39:57 +00:00
|
|
|
'default' => '', // Defaults to current time in query class.
|
2022-11-27 15:03:07 +00:00
|
|
|
'created' => true,
|
|
|
|
'date_query' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// date_modified.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
|
|
|
'name' => 'date_modified',
|
|
|
|
'type' => 'datetime',
|
2023-01-18 16:39:57 +00:00
|
|
|
'default' => '', // Defaults to current time in query class.
|
2022-11-27 15:03:07 +00:00
|
|
|
'modified' => true,
|
|
|
|
'date_query' => true,
|
2023-01-18 16:39:57 +00:00
|
|
|
'sortable' => true,
|
2022-11-27 15:03:07 +00:00
|
|
|
),
|
|
|
|
|
2023-01-18 16:39:57 +00:00
|
|
|
// uuid.
|
2022-11-27 15:03:07 +00:00
|
|
|
array(
|
2023-01-18 16:39:57 +00:00
|
|
|
'uuid' => true,
|
|
|
|
),
|
2022-11-27 15:03:07 +00:00
|
|
|
);
|
|
|
|
}
|