Adding Schema::rename('oldtable','newtable') support
Signed-off-by: Colin Viebrock <colin@viebrock.ca>
This commit is contained in:
@@ -212,6 +212,18 @@ class MySQL extends Grammar {
|
||||
return 'ALTER TABLE '.$this->wrap($table)." ADD {$type} {$name}({$keys})";
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a rename table command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
* @return string
|
||||
*/
|
||||
public function rename(Table $table, Fluent $command)
|
||||
{
|
||||
return 'RENAME TABLE '.$this->wrap($table).' TO '.$this->wrap($command->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop table command.
|
||||
*
|
||||
|
||||
@@ -198,6 +198,18 @@ class Postgres extends Grammar {
|
||||
return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})";
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a rename table command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
* @return string
|
||||
*/
|
||||
public function rename(Table $table, Fluent $command)
|
||||
{
|
||||
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop table command.
|
||||
*
|
||||
@@ -302,7 +314,7 @@ class Postgres extends Grammar {
|
||||
*/
|
||||
public function drop_foreign(Table $table, Fluent $command)
|
||||
{
|
||||
return $this->drop_constraint($table, $command);
|
||||
return $this->drop_constraint($table, $command);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -201,6 +201,18 @@ class SQLite extends Grammar {
|
||||
return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})";
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a rename table command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
* @return string
|
||||
*/
|
||||
public function rename(Table $table, Fluent $command)
|
||||
{
|
||||
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop table command.
|
||||
*
|
||||
|
||||
@@ -212,6 +212,18 @@ class SQLServer extends Grammar {
|
||||
return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})";
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a rename table command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
* @return string
|
||||
*/
|
||||
public function rename(Table $table, Fluent $command)
|
||||
{
|
||||
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop table command.
|
||||
*
|
||||
@@ -320,7 +332,7 @@ class SQLServer extends Grammar {
|
||||
*/
|
||||
public function drop_foreign(Table $table, Fluent $command)
|
||||
{
|
||||
return $this->drop_constraint($table, $command);
|
||||
return $this->drop_constraint($table, $command);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user