From 8ef2fcea3b7fbb3f2a9235634ee35d3f7985eae4 Mon Sep 17 00:00:00 2001 From: Glendon Solsberry Date: Fri, 8 Dec 2017 14:19:12 -0500 Subject: [PATCH] Throws an exception if multiple calls to the underlying method aren't supported --- src/Illuminate/Database/Schema/Blueprint.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php index a46ecd2c0d2b..5a6a99fdda2a 100755 --- a/src/Illuminate/Database/Schema/Blueprint.php +++ b/src/Illuminate/Database/Schema/Blueprint.php @@ -100,6 +100,19 @@ public function toSql(Connection $connection, Grammar $grammar) $statements = []; + if ($connection instanceof \Illuminate\Database\SQLiteConnection) { + $badDDLCount = collect($this->commands) + ->filter(function($item, $key) { + return in_array($item->name, [ 'dropColumn', 'renameColumn' ]); + }) + ->count(); + + if ($badDDLCount > 1) { + throw new \BadMethodCallException("Multiple calls to dropColumn/renameColumn in a single table modification are not supported."); + } + } + + // Each type of command has a corresponding compiler function on the schema // grammar which is used to build the necessary SQL statements to build // the blueprint element, so we'll just call that compilers function.