|
@@ 725-737 (lines=13) @@
|
| 722 |
|
* @param bool $fullpath Whether to treat $patch path as a relative or not |
| 723 |
|
* @return bool False if this was skipped because schema changes are skipped |
| 724 |
|
*/ |
| 725 |
|
protected function addTable( $name, $patch, $fullpath = false ) { |
| 726 |
|
if ( !$this->doTable( $name ) ) { |
| 727 |
|
return true; |
| 728 |
|
} |
| 729 |
|
|
| 730 |
|
if ( $this->db->tableExists( $name, __METHOD__ ) ) { |
| 731 |
|
$this->output( "...$name table already exists.\n" ); |
| 732 |
|
} else { |
| 733 |
|
return $this->applyPatch( $patch, $fullpath, "Creating $name table" ); |
| 734 |
|
} |
| 735 |
|
|
| 736 |
|
return true; |
| 737 |
|
} |
| 738 |
|
|
| 739 |
|
/** |
| 740 |
|
* Add a new field to an existing table |
|
@@ 798-810 (lines=13) @@
|
| 795 |
|
* @param bool $fullpath Whether to treat $patch path as a relative or not |
| 796 |
|
* @return bool False if this was skipped because schema changes are skipped |
| 797 |
|
*/ |
| 798 |
|
protected function dropField( $table, $field, $patch, $fullpath = false ) { |
| 799 |
|
if ( !$this->doTable( $table ) ) { |
| 800 |
|
return true; |
| 801 |
|
} |
| 802 |
|
|
| 803 |
|
if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) { |
| 804 |
|
return $this->applyPatch( $patch, $fullpath, "Table $table contains $field field. Dropping" ); |
| 805 |
|
} else { |
| 806 |
|
$this->output( "...$table table does not contain $field field.\n" ); |
| 807 |
|
} |
| 808 |
|
|
| 809 |
|
return true; |
| 810 |
|
} |
| 811 |
|
|
| 812 |
|
/** |
| 813 |
|
* Drop an index from an existing table |
|
@@ 821-833 (lines=13) @@
|
| 818 |
|
* @param bool $fullpath Whether to treat $patch path as a relative or not |
| 819 |
|
* @return bool False if this was skipped because schema changes are skipped |
| 820 |
|
*/ |
| 821 |
|
protected function dropIndex( $table, $index, $patch, $fullpath = false ) { |
| 822 |
|
if ( !$this->doTable( $table ) ) { |
| 823 |
|
return true; |
| 824 |
|
} |
| 825 |
|
|
| 826 |
|
if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) { |
| 827 |
|
return $this->applyPatch( $patch, $fullpath, "Dropping $index index from table $table" ); |
| 828 |
|
} else { |
| 829 |
|
$this->output( "...$index key doesn't exist.\n" ); |
| 830 |
|
} |
| 831 |
|
|
| 832 |
|
return true; |
| 833 |
|
} |
| 834 |
|
|
| 835 |
|
/** |
| 836 |
|
* Rename an index from an existing table |