Skip to content

Commit

Permalink
Added table renaming.
Browse files Browse the repository at this point in the history
  • Loading branch information
hschletz committed Dec 6, 2020
1 parent bd544bf commit 6e09173
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Database/AbstractDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,21 @@ protected function _getTablePkDeclaration(array $primaryKey, $autoIncrement)
return ",\nPRIMARY KEY (" . implode(', ', $primaryKey) . ')';
}

/**
* Rename a table.
*/
public function renameTable(string $oldName, string $newName): void
{
$this->exec(
sprintf(
'ALTER TABLE %s RENAME TO %s',
$this->prepareIdentifier($oldName),
$this->prepareIdentifier($newName)
)
);
$this->clearCache($oldName);
}

/**
* Drop a table
*
Expand Down

0 comments on commit 6e09173

Please sign in to comment.