From a28656ebc4a30ffb0bbe621e671a186c721e52e0 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 29 Oct 2024 15:18:54 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"[11.x]=20Added=20`dropColumnsIfExists?= =?UTF-8?q?`,=20`dropColumnIfExists`=20and=20`dropFor=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b6e478d5391b1e76257ee21230cf532d5b06ba47. --- src/Illuminate/Database/Schema/Blueprint.php | 39 -------------------- src/Illuminate/Database/Schema/Builder.php | 14 ------- 2 files changed, 53 deletions(-) diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php index 1b8f3e931884..0d34270ceffe 100755 --- a/src/Illuminate/Database/Schema/Blueprint.php +++ b/src/Illuminate/Database/Schema/Blueprint.php @@ -9,7 +9,6 @@ use Illuminate\Database\Schema\Grammars\Grammar; use Illuminate\Database\Schema\Grammars\MySqlGrammar; use Illuminate\Database\Schema\Grammars\SQLiteGrammar; -use Illuminate\Support\Facades\Schema; use Illuminate\Support\Fluent; use Illuminate\Support\Traits\Macroable; @@ -428,25 +427,6 @@ public function dropColumn($columns) return $this->addCommand('dropColumn', compact('columns')); } - /** - * Indicate that the given columns should be dropped if they exist. - * - * @param array|mixed $columns - * @return \Illuminate\Support\Fluent - */ - public function dropColumnIfExists($columns) - { - $columns = is_array($columns) ? $columns : func_get_args(); - - $columns = array_intersect($columns, Schema::getColumnListing($this->getTable())); - - if (empty($columns)) { - return new Fluent; - } - - return $this->dropColumn($columns); - } - /** * Indicate that the given columns should be renamed. * @@ -525,25 +505,6 @@ public function dropForeign($index) return $this->dropIndexCommand('dropForeign', 'foreign', $index); } - /** - * Indicate that the given foreign key should be dropped if it exists. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropForeignIfExists($index) - { - if (is_array($index)) { - $index = $this->createIndexName('foreign', $index); - } - - if (! in_array($index, Schema::getForeignKeys($this->getTable()))) { - return new Fluent; - } - - return $this->dropIndexCommand('dropForeign', 'foreign', $index); - } - /** * Indicate that the given column and foreign key should be dropped. * diff --git a/src/Illuminate/Database/Schema/Builder.php b/src/Illuminate/Database/Schema/Builder.php index 8c14a47ee7d8..9af11e2e0836 100755 --- a/src/Illuminate/Database/Schema/Builder.php +++ b/src/Illuminate/Database/Schema/Builder.php @@ -462,20 +462,6 @@ public function dropColumns($table, $columns) }); } - /** - * Drop columns from a table schema if they exist. - * - * @param string $table - * @param string|array $columns - * @return void - */ - public function dropColumnsIfExists($table, $columns) - { - $this->table($table, function (Blueprint $blueprint) use ($columns) { - $blueprint->dropColumnIfExists($columns); - }); - } - /** * Drop all tables from the database. *