mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-03 15:27:42 +02:00
[ticket/13162] Add truncate table functionality to doctrine tools
PHPBB3-13162
This commit is contained in:
@@ -15,6 +15,7 @@ namespace phpbb\db\tools;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Doctrine\DBAL\Exception;
|
use Doctrine\DBAL\Exception;
|
||||||
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
use Doctrine\DBAL\Schema\AbstractAsset;
|
use Doctrine\DBAL\Schema\AbstractAsset;
|
||||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||||
use Doctrine\DBAL\Schema\Index;
|
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.
|
* Returns an array of indices for either unique and primary keys, or simple indices.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user