Code Duplication    Length = 4-5 lines in 2 locations

includes/wc-update-functions.php 1 location

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

includes/class-wc-install.php 1 location

@@ 386-390 (lines=5) @@
383
		 * Before updating with DBDELTA, remove any primary keys which could be
384
		 * modified due to schema updates.
385
		 */
386
		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}woocommerce_downloadable_product_permissions';" ) ) {
387
			if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}woocommerce_downloadable_product_permissions` LIKE 'permission_id';" ) ) {
388
				$wpdb->query( "ALTER TABLE {$wpdb->prefix}woocommerce_downloadable_product_permissions DROP PRIMARY KEY, ADD `permission_id` bigint(20) NOT NULL PRIMARY KEY AUTO_INCREMENT;" );
389
			}
390
		}
391
392
		dbDelta( self::get_schema() );
393
	}