|
@@ 747-750 (lines=4) @@
|
| 744 |
|
protected function setDefault( $table, $field, $default ) { |
| 745 |
|
|
| 746 |
|
$info = $this->db->fieldInfo( $table, $field ); |
| 747 |
|
if ( $info->defaultValue() !== $default ) { |
| 748 |
|
$this->output( "Changing '$table.$field' default value\n" ); |
| 749 |
|
$this->db->query( "ALTER TABLE $table ALTER $field SET DEFAULT " . $default ); |
| 750 |
|
} |
| 751 |
|
} |
| 752 |
|
|
| 753 |
|
protected function changeNullableField( $table, $field, $null ) { |
|
@@ 761-766 (lines=6) @@
|
| 758 |
|
} |
| 759 |
|
if ( $fi->isNullable() ) { |
| 760 |
|
# # It's NULL - does it need to be NOT NULL? |
| 761 |
|
if ( 'NOT NULL' === $null ) { |
| 762 |
|
$this->output( "Changing '$table.$field' to not allow NULLs\n" ); |
| 763 |
|
$this->db->query( "ALTER TABLE $table ALTER $field SET NOT NULL" ); |
| 764 |
|
} else { |
| 765 |
|
$this->output( "...column '$table.$field' is already set as NULL\n" ); |
| 766 |
|
} |
| 767 |
|
} else { |
| 768 |
|
# # It's NOT NULL - does it need to be NULL? |
| 769 |
|
if ( 'NULL' === $null ) { |
|
@@ 769-774 (lines=6) @@
|
| 766 |
|
} |
| 767 |
|
} else { |
| 768 |
|
# # It's NOT NULL - does it need to be NULL? |
| 769 |
|
if ( 'NULL' === $null ) { |
| 770 |
|
$this->output( "Changing '$table.$field' to allow NULLs\n" ); |
| 771 |
|
$this->db->query( "ALTER TABLE $table ALTER $field DROP NOT NULL" ); |
| 772 |
|
} else { |
| 773 |
|
$this->output( "...column '$table.$field' is already set as NOT NULL\n" ); |
| 774 |
|
} |
| 775 |
|
} |
| 776 |
|
} |
| 777 |
|
|