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