diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2018-06-15 05:25:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-15 05:25:44 +0000 |
commit | 7ebd4bdcf7427abcdf3e3938c9b8a3b9bb66bfbb (patch) | |
tree | acc9f383852c9bf33396672135275e0747dd722d /app/DoctrineMigrations/Version20170511211659.php | |
parent | 36054f5dd42413ed5877db8c50fe9f1a3c6167c6 (diff) | |
parent | 49b4c875985c7b001af711079662dd3684373229 (diff) | |
download | wallabag-7ebd4bdcf7427abcdf3e3938c9b8a3b9bb66bfbb.tar.gz wallabag-7ebd4bdcf7427abcdf3e3938c9b8a3b9bb66bfbb.tar.zst wallabag-7ebd4bdcf7427abcdf3e3938c9b8a3b9bb66bfbb.zip |
Merge pull request #3538 from wallabag/fix-migrations-dash
Fixed migrations with dash into db names
Diffstat (limited to 'app/DoctrineMigrations/Version20170511211659.php')
-rw-r--r-- | app/DoctrineMigrations/Version20170511211659.php | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/app/DoctrineMigrations/Version20170511211659.php b/app/DoctrineMigrations/Version20170511211659.php index f004d1b3..00ce7b1f 100644 --- a/app/DoctrineMigrations/Version20170511211659.php +++ b/app/DoctrineMigrations/Version20170511211659.php | |||
@@ -2,27 +2,15 @@ | |||
2 | 2 | ||
3 | namespace Application\Migrations; | 3 | namespace Application\Migrations; |
4 | 4 | ||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Migrations\SkipMigrationException; | 5 | use Doctrine\DBAL\Migrations\SkipMigrationException; |
7 | use Doctrine\DBAL\Schema\Schema; | 6 | use Doctrine\DBAL\Schema\Schema; |
8 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | 7 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; |
9 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
10 | 8 | ||
11 | /** | 9 | /** |
12 | * Increase the length of the "quote" column of "annotation" table. | 10 | * Increase the length of the "quote" column of "annotation" table. |
13 | */ | 11 | */ |
14 | class Version20170511211659 extends AbstractMigration implements ContainerAwareInterface | 12 | class Version20170511211659 extends WallabagMigration |
15 | { | 13 | { |
16 | /** | ||
17 | * @var ContainerInterface | ||
18 | */ | ||
19 | private $container; | ||
20 | |||
21 | public function setContainer(ContainerInterface $container = null) | ||
22 | { | ||
23 | $this->container = $container; | ||
24 | } | ||
25 | |||
26 | public function up(Schema $schema) | 14 | public function up(Schema $schema) |
27 | { | 15 | { |
28 | $tableName = $this->getTable('annotation'); | 16 | $tableName = $this->getTable('annotation'); |
@@ -30,8 +18,8 @@ class Version20170511211659 extends AbstractMigration implements ContainerAwareI | |||
30 | switch ($this->connection->getDatabasePlatform()->getName()) { | 18 | switch ($this->connection->getDatabasePlatform()->getName()) { |
31 | case 'sqlite': | 19 | case 'sqlite': |
32 | $this->addSql(<<<EOD | 20 | $this->addSql(<<<EOD |
33 | CREATE TEMPORARY TABLE __temp__wallabag_annotation AS | 21 | CREATE TEMPORARY TABLE __temp__wallabag_annotation AS |
34 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges | 22 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges |
35 | FROM ${tableName} | 23 | FROM ${tableName} |
36 | EOD | 24 | EOD |
37 | ); | 25 | ); |
@@ -56,8 +44,8 @@ EOD | |||
56 | ); | 44 | ); |
57 | 45 | ||
58 | $this->addSql(<<<EOD | 46 | $this->addSql(<<<EOD |
59 | INSERT INTO ${tableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges) | 47 | INSERT INTO ${tableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges) |
60 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges | 48 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges |
61 | FROM __temp__wallabag_annotation; | 49 | FROM __temp__wallabag_annotation; |
62 | EOD | 50 | EOD |
63 | ); | 51 | ); |
@@ -88,9 +76,4 @@ EOD | |||
88 | break; | 76 | break; |
89 | } | 77 | } |
90 | } | 78 | } |
91 | |||
92 | private function getTable($tableName) | ||
93 | { | ||
94 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
95 | } | ||
96 | } | 79 | } |