Exemplo n.º 1
0
function gp_upgrade_db()
{
    global $wpdb;
    dbDelta(implode("\n", gp_schema_get()));
    gp_upgrade_data(get_option('gp_db_version'));
    update_option('gp_db_version', GP_DB_VERSION);
}
Exemplo n.º 2
0
function gp_upgrade_db()
{
    global $gpdb;
    $alterations = BP_SQL_Schema_Parser::delta($gpdb, gp_schema_get());
    $errors = $alterations['errors'];
    if ($errors) {
        return $errors;
    }
    gp_upgrade_data(gp_get_option_from_db('gp_db_version'));
    gp_update_db_version();
}
Exemplo n.º 3
0
/**
 * Runs the install/upgrade of the database.
 *
 * @since 1.0.0
 */
function gp_upgrade_db()
{
    global $wpdb;
    $gp_db_version = get_option('gp_db_version');
    if ($gp_db_version && $gp_db_version < 980) {
        $wpdb->query("ALTER TABLE {$wpdb->gp_translation_sets} DROP INDEX project_id_slug_locale, DROP INDEX locale_slug;");
        $wpdb->query("ALTER TABLE {$wpdb->gp_originals} DROP INDEX singular_plural_context;");
        $wpdb->query("ALTER TABLE {$wpdb->gp_meta} DROP INDEX object_type__meta_key, DROP INDEX object_type__object_id__meta_key;");
    }
    dbDelta(implode("\n", gp_schema_get()));
    if ($gp_db_version) {
        gp_upgrade_data($gp_db_version);
    }
    update_option('gp_db_version', GP_DB_VERSION);
}