/** * test rename column */ public function test_rename_column() { //create it $this->adapter->execute_ddl("CREATE TABLE `users` ( name varchar(20) DEFAULT 'abc' NOT NULL);"); $before = $this->adapter->column_info("users", "name"); $this->assertEquals('varchar(20)', $before['type']); $this->assertEquals('name', $before['field']); //rename the name column $this->adapter->rename_column('users', 'name', 'new_name'); $after = $this->adapter->column_info("users", "new_name"); $this->assertEquals('varchar(20)', $after['type']); $this->assertEquals('new_name', $after['field']); // assert that we didnt mess up the NOT NULL and DEFAULT $this->assertEquals('NO', $after['null']); $this->assertEquals('abc', $after['default']); $this->remove_table('users'); }
/** * Rename a column * * @param string $tbl_name the name of the table * @param string $column_name the column name * @param string $new_column_name the new column name * * @return boolean */ public function rename_column($tbl_name, $column_name, $new_column_name) { return $this->_adapter->rename_column($tbl_name, $column_name, $new_column_name); }