Skip to content

Commit

Permalink
fix: add missing custom comment table before moving notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinderk committed Jan 9, 2019
1 parent f5b34e6 commit 4a19204
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion includes/admin/upgrades/upgrade-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3100,13 +3100,35 @@ function give_v224_update_donor_meta_forms_id_callback() {
}
}

/**
* Add custom comment table
*
* @since 2.4.0
*/
function give_v230_add_missing_comment_tables(){
$custom_tables = array(
Give()->comment->db,
Give()->comment->db_meta,
);

/* @var Give_DB $table */
foreach ( $custom_tables as $table ) {
if ( ! $table->installed() ) {
$table->register_table();
}
}
}


/**
* Move donor notes to comment table
*
* @since 2.3.0
*/
function give_v230_move_donor_note_callback() {
// Add comment table if missing.
give_v230_add_missing_comment_tables();

/* @var Give_Updates $give_updates */
$give_updates = Give_Updates::get_instance();

Expand Down Expand Up @@ -3161,6 +3183,9 @@ function give_v230_move_donor_note_callback() {
function give_v230_move_donation_note_callback() {
global $wpdb;

// Add comment table if missing.
give_v230_add_missing_Comment_tables();

/* @var Give_Updates $give_updates */
$give_updates = Give_Updates::get_instance();

Expand Down Expand Up @@ -3345,4 +3370,4 @@ function give_v240_update_form_goal_progress_callback() {
give_set_upgrade_complete( 'v240_update_form_goal_progress' );

}
}
}

0 comments on commit 4a19204

Please sign in to comment.