aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations/Version20161122203647.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-26 15:40:42 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-28 14:28:35 +0100
commit84c6a48df412af7a15a63de5484c4bbcf27de33e (patch)
tree2e428e005fc92b8fde621c1ae224ab1222bae00b /app/DoctrineMigrations/Version20161122203647.php
parenta4d55a9161144f7e0daafff8da13dabc9e090ae2 (diff)
downloadwallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.tar.gz
wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.tar.zst
wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.zip
Added dropColumn for SQLite and some enhancements
Diffstat (limited to 'app/DoctrineMigrations/Version20161122203647.php')
-rw-r--r--app/DoctrineMigrations/Version20161122203647.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/DoctrineMigrations/Version20161122203647.php b/app/DoctrineMigrations/Version20161122203647.php
index 354a10e8..9c1557eb 100644
--- a/app/DoctrineMigrations/Version20161122203647.php
+++ b/app/DoctrineMigrations/Version20161122203647.php
@@ -40,15 +40,15 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI
40 */ 40 */
41 public function up(Schema $schema) 41 public function up(Schema $schema)
42 { 42 {
43 $this->skipIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'This up migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.'); 43 $userTable = $schema->getTable($this->getTable('user'));
44 44
45 $this->skipIf(false === $schema->getTable($this->getTable('user'))->hasColumn('expired'), 'It seems that you already played this migration.'); 45 $this->skipIf(false === $userTable->hasColumn('expired'), 'It seems that you already played this migration.');
46 46
47 $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP expired'); 47 $userTable->dropColumn('expired');
48 48
49 $this->skipIf(false === $schema->getTable($this->getTable('user'))->hasColumn('credentials_expired'), 'It seems that you already played this migration.'); 49 $this->skipIf(false === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.');
50 50
51 $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP credentials_expired'); 51 $userTable->dropColumn('credentials_expired');
52 } 52 }
53 53
54 /** 54 /**
@@ -56,7 +56,8 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI
56 */ 56 */
57 public function down(Schema $schema) 57 public function down(Schema $schema)
58 { 58 {
59 $this->addSql('ALTER TABLE '.$this->getTable('user').' ADD expired tinyint(1) NULL DEFAULT 0'); 59 $userTable = $schema->getTable($this->getTable('user'));
60 $this->addSql('ALTER TABLE '.$this->getTable('user').' ADD credentials_expired tinyint(1) NULL DEFAULT 0'); 60 $userTable->addColumn('expired', 'smallint');
61 $userTable->addColumn('credentials_expired', 'smallint');
61 } 62 }
62} 63}