public function testIndexDefaultNames()
 {
     $blueprint = new Blueprint('users');
     $blueprint->unique(array('foo', 'bar'));
     $commands = $blueprint->getCommands();
     $this->assertEquals('users_foo_bar_unique', $commands[0]->index);
     $blueprint = new Blueprint('users');
     $blueprint->index('foo');
     $commands = $blueprint->getCommands();
     $this->assertEquals('users_foo_index', $commands[0]->index);
 }
 /**
  * Compile a drop primary key command.
  *
  * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
  * @param  \Illuminate\Support\Fluent  $command
  * @return string
  */
 public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
 {
     $table = $blueprint->getTable();
     $table = $this->wrapTable($blueprint);
     return "alter table {$table} drop constraint {$command->index}";
 }
示例#3
0
 /**
  * Execute the blueprint to build / modify the table.
  *
  * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
  * @return void
  */
 protected function build(Blueprint $blueprint)
 {
     $blueprint->build($this->connection, $this->grammar);
 }
 public function testAddingBinary()
 {
     $blueprint = new Blueprint('users');
     $blueprint->binary('foo');
     $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('alter table "users" add "foo" varbinary(max) not null', $statements[0]);
 }
 /**
  * Compile a drop primary key command.
  *
  * @param  \Illuminate\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";
 }