diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-06-14 13:43:09 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-06-14 13:43:09 +0200 |
commit | bfe7a692261760517199a3797191fd214fc2ee6c (patch) | |
tree | daa792d7212ebe39c5f54c4ea825146a93da40ca /src | |
parent | 36054f5dd42413ed5877db8c50fe9f1a3c6167c6 (diff) | |
download | wallabag-bfe7a692261760517199a3797191fd214fc2ee6c.tar.gz wallabag-bfe7a692261760517199a3797191fd214fc2ee6c.tar.zst wallabag-bfe7a692261760517199a3797191fd214fc2ee6c.zip |
Fixed migrations with dash into db name
Diffstat (limited to 'src')
-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 | } | ||