Skip to content

Commit

Permalink
Update routine for Database version 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilsoncc committed Jan 25, 2020
1 parent 899494d commit 2ce546f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions inc/upgrade/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function upgrade_database() {
upgrade_database_2();
}

if ( $database_version < 3 ) {
upgrade_database_3();
}

update_site_option( 'cavalcade_db_version', DATABASE_VERSION );

wp_cache_delete( 'jobs', 'cavalcade-jobs' );
Expand Down Expand Up @@ -62,3 +66,19 @@ function upgrade_database_2() {
);
}
}

/**
* Upgrade Cavalcade database tables to version 3.
*
* Add indexes required for pre-flight filters.
*/
function upgrade_database_3() {
global $wpdb;

$query = "ALTER TABLE `{$wpdb->base_prefix}cavalcade_jobs`
ADD INDEX `site` (`site`),
ADD INDEX `hook_args` (`hook`, `args`(50)),
ADD INDEX `nextrun` (`nextrun`)";

$wpdb->query( $query );
}

0 comments on commit 2ce546f

Please sign in to comment.