Created
April 17, 2014 07:05
-
-
Save jwpage/10959596 to your computer and use it in GitHub Desktop.
Blueprint SQL Execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php | |
index 836d013..035dc71 100755 | |
--- a/src/Illuminate/Database/Schema/Blueprint.php | |
+++ b/src/Illuminate/Database/Schema/Blueprint.php | |
@@ -58,10 +58,22 @@ class Blueprint { | |
*/ | |
public function build(Connection $connection, Grammar $grammar) | |
{ | |
- foreach ($this->toSql($connection, $grammar) as $statement) | |
- { | |
- $connection->statement($statement); | |
- } | |
+ $this->addImpliedCommands(); | |
+ foreach ($this->commands as $command) | |
+ { | |
+ $method = 'compile'.ucfirst($command->name); | |
+ | |
+ if (method_exists($grammar, $method)) | |
+ { | |
+ if ( ! is_null($sql = $grammar->$method($this, $command, $connection))) | |
+ { | |
+ foreach ((array)$sql as $statement) | |
+ { | |
+ $connection->statement($statement); | |
+ } | |
+ } | |
+ } | |
+ } | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment