/**
  * test change column
  */
 public function test_change_column()
 {
     //create it
     $this->adapter->execute_ddl("CREATE TABLE `users` ( name varchar(20), age int(3) );");
     //verify its type
     $col = $this->adapter->column_info("users", "name");
     $this->assertEquals('varchar(20)', $col['type']);
     $this->assertEquals('', $col['default']);
     //change it, add a default too!
     $this->adapter->change_column("users", "name", "string", array('default' => 'abc', 'limit' => 128));
     $col = $this->adapter->column_info("users", "name");
     $this->assertEquals('varchar(128)', $col['type']);
     $this->assertEquals('abc', $col['default']);
     // Test collate option
     $this->adapter->change_column("users", "name", "string", array('default' => 'abc', 'limit' => 128, 'collate' => 'ascii_bin'));
     $col = $this->adapter->column_info('users', 'name');
     $this->assertEquals('ascii_bin', $col['collation']);
     $this->remove_table('users');
 }
Ejemplo n.º 2
0
 /**
  * Change a column
  *
  * @param string $table_name the name of the table
  * @param string $column_name the column name
  * @param string $type the column type
  * @param array|string $options
  *
  * @return boolean
  */
 public function change_column($table_name, $column_name, $type, $options = array())
 {
     return $this->_adapter->change_column($table_name, $column_name, $type, $options);
 }