@@ 748-762 (lines=15) @@ | ||
745 | * @param bool $fullpath Whether to treat $patch path as a relative or not |
|
746 | * @return bool False if this was skipped because schema changes are skipped |
|
747 | */ |
|
748 | protected function addField( $table, $field, $patch, $fullpath = false ) { |
|
749 | if ( !$this->doTable( $table ) ) { |
|
750 | return true; |
|
751 | } |
|
752 | ||
753 | if ( !$this->db->tableExists( $table, __METHOD__ ) ) { |
|
754 | $this->output( "...$table table does not exist, skipping new field patch.\n" ); |
|
755 | } elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) { |
|
756 | $this->output( "...have $field field in $table table.\n" ); |
|
757 | } else { |
|
758 | return $this->applyPatch( $patch, $fullpath, "Adding $field field to table $table" ); |
|
759 | } |
|
760 | ||
761 | return true; |
|
762 | } |
|
763 | ||
764 | /** |
|
765 | * Add a new index to an existing table |
|
@@ 773-787 (lines=15) @@ | ||
770 | * @param bool $fullpath Whether to treat $patch path as a relative or not |
|
771 | * @return bool False if this was skipped because schema changes are skipped |
|
772 | */ |
|
773 | protected function addIndex( $table, $index, $patch, $fullpath = false ) { |
|
774 | if ( !$this->doTable( $table ) ) { |
|
775 | return true; |
|
776 | } |
|
777 | ||
778 | if ( !$this->db->tableExists( $table, __METHOD__ ) ) { |
|
779 | $this->output( "...skipping: '$table' table doesn't exist yet.\n" ); |
|
780 | } elseif ( $this->db->indexExists( $table, $index, __METHOD__ ) ) { |
|
781 | $this->output( "...index $index already set on $table table.\n" ); |
|
782 | } else { |
|
783 | return $this->applyPatch( $patch, $fullpath, "Adding index $index to table $table" ); |
|
784 | } |
|
785 | ||
786 | return true; |
|
787 | } |
|
788 | ||
789 | /** |
|
790 | * Drop a field from an existing table |