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");




No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: