diff options
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php | 43 |
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 | |||
3 | namespace Wallabag\CoreBundle\Doctrine; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | abstract 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 | } | ||