rename_table() public method

Also renames a table's primary key sequence if the sequence name matches the Ruckusing Migrations default.
public rename_table ( string $name, string $new_name ) : boolean
$name string the current table name
$new_name string the new table name
return boolean
 /**
  * test renaming table
  */
 public function test_rename_table()
 {
     $this->adapter->drop_table('users');
     $this->adapter->drop_table('users_new');
     //create it
     $table = $this->adapter->create_table('users');
     $table->column('name', 'string', array('limit' => 20));
     $table->finish();
     $this->assertEquals(true, $this->adapter->has_table('users'));
     $this->assertEquals(false, $this->adapter->has_table('users_new'));
     //rename it
     $this->adapter->rename_table('users', 'users_new');
     $this->assertEquals(false, $this->adapter->has_table('users'));
     $this->assertEquals(true, $this->adapter->has_table('users_new'));
     //clean up
     $this->adapter->drop_table('users');
     $this->adapter->drop_table('users_new');
 }
Beispiel #2
0
 /**
  * Rename a table
  *
  * @param string $name     the name of the table
  * @param string $new_name the new name of the table
  *
  * @return boolean
  */
 public function rename_table($name, $new_name)
 {
     return $this->_adapter->rename_table($name, $new_name);
 }