aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
new file mode 100644
index 00000000..eb5ae407
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
@@ -0,0 +1,43 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10abstract class WallabagMigration extends AbstractMigration implements ContainerAwareInterface
11{
12 /**
13 * @var ContainerInterface
14 */
15 protected $container;
16
17 // because there are declared as abstract in `AbstractMigration` we need to delarer here too
18 public function up(Schema $schema)
19 {
20 }
21
22 public function down(Schema $schema)
23 {
24 }
25
26 public function setContainer(ContainerInterface $container = null)
27 {
28 $this->container = $container;
29 }
30
31 protected function getTable($tableName)
32 {
33 $table = $this->container->getParameter('database_table_prefix') . $tableName;
34
35 // escape table name is handled using " on postgresql
36 if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
37 return '"' . $table . '"';
38 }
39
40 // return escaped table
41 return '`' . $table . '`';
42 }
43}