3 namespace Wallabag\CoreBundle\Doctrine
;
5 use Doctrine\DBAL\Migrations\AbstractMigration
;
6 use Doctrine\DBAL\Schema\Schema
;
7 use Symfony\Component\DependencyInjection\ContainerAwareInterface
;
8 use Symfony\Component\DependencyInjection\ContainerInterface
;
10 abstract class WallabagMigration
extends AbstractMigration
implements ContainerAwareInterface
12 const UN_ESCAPED_TABLE
= true;
15 * @var ContainerInterface
19 // because there are declared as abstract in `AbstractMigration` we need to delarer here too
20 public function up(Schema
$schema)
24 public function down(Schema
$schema)
28 public function setContainer(ContainerInterface
$container = null)
30 $this->container
= $container;
33 protected function getTable($tableName, $unEscaped = false)
35 $table = $this->container
->getParameter('database_table_prefix') . $tableName;
37 if (self
::UN_ESCAPED_TABLE
=== $unEscaped) {
41 // escape table name is handled using " on postgresql
42 if ('postgresql' === $this->connection
->getDatabasePlatform()->getName()) {
43 return '"' . $table . '"';
46 // return escaped table
47 return '`' . $table . '`';