Code Duplication    Length = 9-9 lines in 2 locations

includes/installer/PostgresUpdater.php 2 locations

@@ 702-710 (lines=9) @@
699
		} else {
700
			$this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" );
701
			$sql = "ALTER TABLE $table ALTER $field TYPE $newtype";
702
			if ( strlen( $default ) ) {
703
				$res = [];
704
				if ( preg_match( '/DEFAULT (.+)/', $default, $res ) ) {
705
					$sqldef = "ALTER TABLE $table ALTER $field SET DEFAULT $res[1]";
706
					$this->db->query( $sqldef );
707
					$default = preg_replace( '/\s*DEFAULT .+/', '', $default );
708
				}
709
				$sql .= " USING $default";
710
			}
711
			$this->db->query( $sql );
712
		}
713
	}
@@ 731-739 (lines=9) @@
728
			$this->db->query( "DELETE from $table" );
729
			$this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" );
730
			$sql = "ALTER TABLE $table ALTER $field TYPE $newtype";
731
			if ( strlen( $default ) ) {
732
				$res = [];
733
				if ( preg_match( '/DEFAULT (.+)/', $default, $res ) ) {
734
					$sqldef = "ALTER TABLE $table ALTER $field SET DEFAULT $res[1]";
735
					$this->db->query( $sqldef );
736
					$default = preg_replace( '/\s*DEFAULT .+/', '', $default );
737
				}
738
				$sql .= " USING $default";
739
			}
740
			$this->db->query( $sql );
741
		}
742
	}