aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations/Version20170511211659.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/DoctrineMigrations/Version20170511211659.php')
-rw-r--r--app/DoctrineMigrations/Version20170511211659.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/app/DoctrineMigrations/Version20170511211659.php b/app/DoctrineMigrations/Version20170511211659.php
index f2d5cf5e..f004d1b3 100644
--- a/app/DoctrineMigrations/Version20170511211659.php
+++ b/app/DoctrineMigrations/Version20170511211659.php
@@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
9use Symfony\Component\DependencyInjection\ContainerInterface; 9use Symfony\Component\DependencyInjection\ContainerInterface;
10 10
11/** 11/**
12 * Increase the length of the "quote" column of "annotation" table 12 * Increase the length of the "quote" column of "annotation" table.
13 */ 13 */
14class Version20170511211659 extends AbstractMigration implements ContainerAwareInterface 14class Version20170511211659 extends AbstractMigration implements ContainerAwareInterface
15{ 15{
@@ -23,11 +23,6 @@ class Version20170511211659 extends AbstractMigration implements ContainerAwareI
23 $this->container = $container; 23 $this->container = $container;
24 } 24 }
25 25
26 private function getTable($tableName)
27 {
28 return $this->container->getParameter('database_table_prefix') . $tableName;
29 }
30
31 public function up(Schema $schema) 26 public function up(Schema $schema)
32 { 27 {
33 $tableName = $this->getTable('annotation'); 28 $tableName = $this->getTable('annotation');
@@ -68,13 +63,11 @@ EOD
68 ); 63 );
69 $this->addSql('DROP TABLE __temp__wallabag_annotation'); 64 $this->addSql('DROP TABLE __temp__wallabag_annotation');
70 break; 65 break;
71
72 case 'mysql': 66 case 'mysql':
73 $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote TEXT NOT NULL'); 67 $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote TEXT NOT NULL');
74 break; 68 break;
75
76 case 'postgresql': 69 case 'postgresql':
77 $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE TEXT'); 70 $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE TEXT');
78 break; 71 break;
79 } 72 }
80 } 73 }
@@ -87,14 +80,17 @@ EOD
87 case 'sqlite': 80 case 'sqlite':
88 throw new SkipMigrationException('Too complex ...'); 81 throw new SkipMigrationException('Too complex ...');
89 break; 82 break;
90
91 case 'mysql': 83 case 'mysql':
92 $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote VARCHAR(255) NOT NULL'); 84 $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote VARCHAR(255) NOT NULL');
93 break; 85 break;
94
95 case 'postgresql': 86 case 'postgresql':
96 $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE VARCHAR(255)'); 87 $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE VARCHAR(255)');
97 break; 88 break;
98 } 89 }
99 } 90 }
91
92 private function getTable($tableName)
93 {
94 return $this->container->getParameter('database_table_prefix') . $tableName;
95 }
100} 96}