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); }
public function testAddingUniqueKey() { $blueprint = new Blueprint('users'); $blueprint->unique('foo', 'bar'); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('create unique index bar on "users" ("foo")', $statements[0]); }
public function testAddingUniqueKey() { $blueprint = new Blueprint('users'); $blueprint->unique('foo', 'bar'); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" add constraint bar unique ("foo")', $statements[0]); }