コード例 #1
0
ファイル: Grammar.php プロジェクト: darrengopower/framework
 /**
  * @param \Notadd\Foundation\Database\Schema\Blueprint $blueprint
  * @param \Illuminate\Support\Fluent $command
  * @param \Notadd\Foundation\Database\Connection $connection
  * @return array
  * @throws \Doctrine\DBAL\DBALException
  */
 public function compileChange(Blueprint $blueprint, Fluent $command, Connection $connection)
 {
     if (!$connection->isDoctrineAvailable()) {
         throw new RuntimeException(sprintf('Changing columns for table "%s" requires Doctrine DBAL; install "doctrine/dbal".', $blueprint->getTable()));
     }
     $schema = $connection->getDoctrineSchemaManager();
     $tableDiff = $this->getChangedDiff($blueprint, $schema);
     if ($tableDiff !== false) {
         return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff);
     }
     return [];
 }