mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-27 17:28:39 +00:00
Fixed migrations with dash into db name
This commit is contained in:
parent
36054f5dd4
commit
bfe7a69226
37 changed files with 136 additions and 705 deletions
43
src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
Normal file
43
src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Doctrine;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
abstract class WallabagMigration extends AbstractMigration implements ContainerAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
// because there are declared as abstract in `AbstractMigration` we need to delarer here too
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
}
|
||||
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
protected function getTable($tableName)
|
||||
{
|
||||
$table = $this->container->getParameter('database_table_prefix') . $tableName;
|
||||
|
||||
// escape table name is handled using " on postgresql
|
||||
if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
|
||||
return '"' . $table . '"';
|
||||
}
|
||||
|
||||
// return escaped table
|
||||
return '`' . $table . '`';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue