Definition:
function pre_schema_upgrade() {}
Runs before the schema is upgraded.
Source code
function pre_schema_upgrade() { global $wp_current_db_version, $wp_db_version, $wpdb; // Upgrade versions prior to 2.9 if ( $wp_current_db_version < 11557 ) { // Delete duplicate options. Keep the option with the highest option_id. $wpdb->query("DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id"); // Drop the old primary key and add the new. $wpdb->query("ALTER TABLE $wpdb->options DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)"); // Drop the old option_name index. dbDelta() doesn't do the drop. $wpdb->query("ALTER TABLE $wpdb->options DROP INDEX option_name"); } }
2621
No comments yet... Be the first to leave a reply!