Exemplo n.º 1
0
 /**
  * @param \Notadd\Foundation\Database\Schema\Blueprint $blueprint
  * @param \Doctrine\DBAL\Schema\Table $table
  * @return \Doctrine\DBAL\Schema\TableDiff
  */
 protected function getTableWithColumnChanges(Blueprint $blueprint, Table $table)
 {
     $table = clone $table;
     foreach ($blueprint->getChangedColumns() as $fluent) {
         $column = $this->getDoctrineColumnForChange($table, $fluent);
         foreach ($fluent->getAttributes() as $key => $value) {
             if (!is_null($option = $this->mapFluentOptionToDoctrine($key))) {
                 if (method_exists($column, $method = 'set' . ucfirst($option))) {
                     $column->{$method}($this->mapFluentValueToDoctrine($option, $value));
                 }
             }
         }
     }
     return $table;
 }
Exemplo n.º 2
0
 /**
  * @param \Notadd\Foundation\Database\Schema\Blueprint $blueprint
  * @return void
  */
 protected function build(Blueprint $blueprint)
 {
     $blueprint->build($this->connection, $this->grammar);
 }
Exemplo n.º 3
0
 /**
  * @param \Notadd\Foundation\Database\Schema\Blueprint $blueprint
  * @param \Illuminate\Support\Fluent $command
  * @return string
  */
 public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
 {
     $table = $blueprint->getTable();
     return 'alter table ' . $this->wrapTable($blueprint) . " drop constraint {$table}_pkey";
 }
Exemplo n.º 4
0
 /**
  * @param \Notadd\Foundation\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();
 }