Skip to content

Commit

Permalink
Merge pull request #8397 from akurtz/patch-1
Browse files Browse the repository at this point in the history
[5.0] Add dropIfExists() support for SQL Server
  • Loading branch information
taylorotwell committed Apr 12, 2015
2 parents ffc9662 + 7ce580c commit 30ae125
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ public function compileDrop(Blueprint $blueprint, Fluent $command)
return 'drop table '.$this->wrapTable($blueprint);
}

/**
* Compile a drop table (if exists) command.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
* @param \Illuminate\Support\Fluent $command
* @return string
*/
public function compileDropIfExists(Blueprint $blueprint, Fluent $command)
{
return 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = \''.$blueprint->getTable().'\') drop table '.$blueprint->getTable();
}

/**
* Compile a drop column command.
*
Expand Down

0 comments on commit 30ae125

Please sign in to comment.