mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/13162] Add truncate table functionality to doctrine tools
PHPBB3-13162
This commit is contained in:
parent
afe41e3916
commit
5a1fe1db12
1 changed files with 19 additions and 0 deletions
|
@ -15,6 +15,7 @@ namespace phpbb\db\tools;
|
|||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\AbstractAsset;
|
||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
|
@ -363,6 +364,24 @@ class doctrine implements tools_interface
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate the table
|
||||
*
|
||||
* @param string $table_name
|
||||
* @return void
|
||||
*/
|
||||
public function sql_truncate_table(string $table_name)
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->connection->executeQuery($this->get_schema_manager()->getDatabasePlatform()->getTruncateTableSQL($table_name));
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of indices for either unique and primary keys, or simple indices.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue