register_migrations( $migrations ); // Run pending migrations $results = $runner->run_pending_migrations(); // Update schema version if all migrations successful if ( $results['success'] ) { $schema = new MonsterInsights_DB_Schema(); $old_version = $schema->get_current_version(); $new_version = $schema->get_target_version(); $schema->update_version( $new_version ); $schema->record_upgrade( $old_version, $new_version ); } return $results; } /** * Get the cache table instance. * * Helper function to get a singleton instance of the cache table. * * @since 9.11.0 * @return MonsterInsights_Cache_Table Cache table instance. */ function monsterinsights_get_cache_table() { static $instance = null; if ( $instance === null ) { $instance = new MonsterInsights_Cache_Table(); } return $instance; } /** * Get the database schema manager instance. * * Helper function to get a singleton instance of the schema manager. * * @since 9.11.0 * @return MonsterInsights_DB_Schema Schema manager instance. */ function monsterinsights_get_db_schema() { static $instance = null; if ( $instance === null ) { $instance = new MonsterInsights_DB_Schema(); // Register cache table $instance->register_table( monsterinsights_get_cache_table() ); } return $instance; }