Code Duplication    Length = 4-5 lines in 2 locations

includes/wc-update-functions.php 1 location

@@ 873-876 (lines=4) @@
870
	 * Old (table rate) shipping zones to new core shipping zones migration.
871
	 * zone_enabled and zone_type are no longer used, but it's safe to leave them be.
872
	 */
873
	if ( $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}woocommerce_shipping_zones` LIKE 'zone_enabled';" ) ) {
874
		$wpdb->query( "ALTER TABLE {$wpdb->prefix}woocommerce_shipping_zones CHANGE `zone_type` `zone_type` VARCHAR(40) NOT NULL DEFAULT '';" );
875
		$wpdb->query( "ALTER TABLE {$wpdb->prefix}woocommerce_shipping_zones CHANGE `zone_enabled` `zone_enabled` INT(1) NOT NULL DEFAULT 1;" );
876
	}
877
}
878
879
function wc_update_260_zone_methods() {

includes/class-wc-install.php 1 location

@@ 399-403 (lines=5) @@
396
		 * Before updating with DBDELTA, remove any primary keys which could be
397
		 * modified due to schema updates.
398
		 */
399
		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}woocommerce_downloadable_product_permissions';" ) ) {
400
			if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}woocommerce_downloadable_product_permissions` LIKE 'permission_id';" ) ) {
401
				$wpdb->query( "ALTER TABLE {$wpdb->prefix}woocommerce_downloadable_product_permissions DROP PRIMARY KEY, ADD `permission_id` bigint(20) NOT NULL PRIMARY KEY AUTO_INCREMENT;" );
402
			}
403
		}
404
405
		dbDelta( self::get_schema() );
406