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); }