Merge pull request #480 from cviebrock/schema-rename

Schema::rename('oldtable','newtable') support
This commit is contained in:
Taylor Otwell
2012-07-19 13:42:34 -07:00
6 changed files with 80 additions and 2 deletions

View File

@@ -40,6 +40,25 @@ class Schema {
return static::execute($table);
}
/**
* Rename a database table in the schema.
*
* @param string $table
* @param string $name
* @return void
*/
public static function rename($table, $new_name)
{
$table = new Schema\Table($table);
// To indicate that the table needs to be renamed, we will run the
// "rename" command on the table instance and pass the instance to
// the execute method as calling a Closure isn't needed.
$table->rename($new_name);
return static::execute($table);
}
/**
* Drop a database table from the schema.
*