← All changes
|
vendor/woocommerce/action-scheduler/classes/schema/ActionScheduler_StoreSchema.php
+12
-9
1.5.4
→
trunk
View file →
| @@ -13,9 +13,13 @@ | ||
| 13 | 13 | const GROUPS_TABLE = 'actionscheduler_groups'; |
| 14 | 14 | const DEFAULT_DATE = '0000-00-00 00:00:00'; |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * @var int Increment this value to trigger a schema update. | |
| 17 | + * Schema version. | |
| 18 | + * | |
| 19 | + * Increment this value to trigger a schema update. | |
| 20 | + * | |
| 21 | + * @var int | |
| 18 | 22 | */ |
| 19 | 23 | protected $schema_version = 7; |
| 20 | 24 | |
| 21 | 25 | /** |
| @@ -21,13 +25,13 @@ | ||
| 21 | 25 | /** |
| 22 | 26 | * Construct. |
| 23 | 27 | */ |
| 24 | 28 | public function __construct() { |
| 25 | - $this->tables = [ | |
| 29 | + $this->tables = array( | |
| 26 | 30 | self::ACTIONS_TABLE, |
| 27 | 31 | self::CLAIMS_TABLE, |
| 28 | 32 | self::GROUPS_TABLE, |
| 29 | - ]; | |
| 33 | + ); | |
| 30 | 34 | } |
| 31 | 35 | |
| 32 | 36 | /** |
| 33 | 37 | * Performs additional setup work required to support this schema. |
| @@ -42,18 +46,19 @@ | ||
| 42 | 46 | * @param string $table Table name. |
| 43 | 47 | */ |
| 44 | 48 | protected function get_table_definition( $table ) { |
| 45 | 49 | global $wpdb; |
| 46 | - $table_name = $wpdb->$table; | |
| 47 | - $charset_collate = $wpdb->get_charset_collate(); | |
| 50 | + $table_name = $wpdb->$table; | |
| 51 | + $charset_collate = $wpdb->get_charset_collate(); | |
| 52 | + $default_date = self::DEFAULT_DATE; | |
| 48 | 53 | // phpcs:ignore Squiz.PHP.CommentedOutCode |
| 49 | 54 | $max_index_length = 191; // @see wp_get_db_schema() |
| 55 | + | |
| 50 | 56 | $hook_status_scheduled_date_gmt_max_index_length = $max_index_length - 20 - 8; // - status, - scheduled_date_gmt |
| 51 | - $default_date = self::DEFAULT_DATE; | |
| 57 | + | |
| 52 | 58 | switch ( $table ) { |
| 53 | 59 | |
| 54 | 60 | case self::ACTIONS_TABLE: |
| 55 | - | |
| 56 | 61 | return "CREATE TABLE {$table_name} ( |
| 57 | 62 | action_id bigint(20) unsigned NOT NULL auto_increment, |
| 58 | 63 | hook varchar(191) NOT NULL, |
| 59 | 64 | status varchar(20) NOT NULL, |
| @@ -78,9 +83,8 @@ | ||
| 78 | 83 | KEY `claim_id_status_scheduled_date_gmt` (`claim_id`, `status`, `scheduled_date_gmt`) |
| 79 | 84 | ) $charset_collate"; |
| 80 | 85 | |
| 81 | 86 | case self::CLAIMS_TABLE: |
| 82 | - | |
| 83 | 87 | return "CREATE TABLE {$table_name} ( |
| 84 | 88 | claim_id bigint(20) unsigned NOT NULL auto_increment, |
| 85 | 89 | date_created_gmt datetime NULL default '{$default_date}', |
| 86 | 90 | PRIMARY KEY (claim_id), |
| @@ -87,9 +91,8 @@ | ||
| 87 | 91 | KEY date_created_gmt (date_created_gmt) |
| 88 | 92 | ) $charset_collate"; |
| 89 | 93 | |
| 90 | 94 | case self::GROUPS_TABLE: |
| 91 | - | |
| 92 | 95 | return "CREATE TABLE {$table_name} ( |
| 93 | 96 | group_id bigint(20) unsigned NOT NULL auto_increment, |
| 94 | 97 | slug varchar(255) NOT NULL, |
| 95 | 98 | PRIMARY KEY (group_id), |