@@ 808-815 (lines=8) @@ | ||
805 | return; |
|
806 | } |
|
807 | $conname = $fi->conname(); |
|
808 | if ( $fi->conname() ) { |
|
809 | $this->output( "Dropping foreign key constraint on '$table.$field'\n" ); |
|
810 | $conclause = "CONSTRAINT \"$conname\""; |
|
811 | $command = "ALTER TABLE $table DROP CONSTRAINT $conname"; |
|
812 | $this->db->query( $command ); |
|
813 | } else { |
|
814 | $this->output( "...foreign key constraint on '$table.$field' already does not exist\n" ); |
|
815 | }; |
|
816 | } |
|
817 | ||
818 | protected function changeFkeyDeferrable( $table, $field, $clause ) { |
|
@@ 831-839 (lines=9) @@ | ||
828 | } |
|
829 | $this->output( "Altering column '$table.$field' to be DEFERRABLE INITIALLY DEFERRED\n" ); |
|
830 | $conname = $fi->conname(); |
|
831 | if ( $fi->conname() ) { |
|
832 | $conclause = "CONSTRAINT \"$conname\""; |
|
833 | $command = "ALTER TABLE $table DROP CONSTRAINT $conname"; |
|
834 | $this->db->query( $command ); |
|
835 | } else { |
|
836 | $this->output( "Column '$table.$field' does not have a foreign key " . |
|
837 | "constraint, will be added\n" ); |
|
838 | $conclause = ""; |
|
839 | } |
|
840 | $command = |
|
841 | "ALTER TABLE $table ADD $conclause " . |
|
842 | "FOREIGN KEY ($field) REFERENCES $clause DEFERRABLE INITIALLY DEFERRED"; |