public function test_can_create_index_with_custom_name()
 {
     //create it
     $this->adapter->execute_ddl("CREATE TABLE `users` ( name varchar(20), age int(3) );");
     $base = new Ruckusing_BaseMigration();
     $base->set_adapter($this->adapter);
     $base->add_index("users", "name", array('name' => 'my_special_index'));
     //ensure it exists
     $this->assertEquals(true, $this->adapter->has_index("users", "name", array('name' => 'my_special_index')));
     //drop it
     $base->remove_index("users", "name", array('name' => 'my_special_index'));
     $this->assertEquals(false, $this->adapter->has_index("users", "my_special_index"));
 }
 public function test_index_name_too_long_throws_exception()
 {
     $this->setExpectedException('Ruckusing_InvalidIndexNameException');
     $bm = new Ruckusing_BaseMigration();
     $bm->set_adapter($this->adapter);
     $ts = microtime();
     $table_name = "users_{$ts}";
     $table = $bm->create_table($table_name, array('id' => false));
     $table->column('somecolumnthatiscrazylong', 'integer');
     $table->column('anothercolumnthatiscrazylongrodeclown', 'integer');
     $sql = $table->finish();
     $bm->add_index($table_name, array('somecolumnthatiscrazylong', 'anothercolumnthatiscrazylongrodeclown'));
     $this->remove_table($table_name);
 }
 public function test_custom_primary_key_with_auto_increment()
 {
     $bm = new Ruckusing_BaseMigration();
     $bm->set_adapter($this->adapter);
     $ts = time();
     $table_name = "users_{$ts}";
     $table = $bm->create_table($table_name, array('id' => false));
     $table->column('user_id', 'integer', array('unsigned' => true, 'primary_key' => true, 'auto_increment' => true));
     $sql = $table->finish();
     $user_id_actual = $this->adapter->column_info($table_name, "user_id");
     $this->assertEquals('PRI', $user_id_actual['key']);
     $this->assertEquals('auto_increment', $user_id_actual['extra']);
     //make sure there is NO 'id' column
     $id_actual = $this->adapter->column_info($table_name, "id");
     $this->assertEquals(NULL, $id_actual);
     $bm->drop_table($table_name);
 }