Skip to content

Commit

Permalink
Throws an exception if multiple calls to the underlying method aren't…
Browse files Browse the repository at this point in the history
… supported
  • Loading branch information
gms8994 committed Dec 8, 2017
1 parent 508005a commit 8ef2fce
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Illuminate/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8ef2fce

Please sign in to comment.