diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-26 15:40:42 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-28 14:28:35 +0100 |
commit | 84c6a48df412af7a15a63de5484c4bbcf27de33e (patch) | |
tree | 2e428e005fc92b8fde621c1ae224ab1222bae00b /app/DoctrineMigrations/Version20161118134328.php | |
parent | a4d55a9161144f7e0daafff8da13dabc9e090ae2 (diff) | |
download | wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.tar.gz wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.tar.zst wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.zip |
Added dropColumn for SQLite and some enhancements
Diffstat (limited to 'app/DoctrineMigrations/Version20161118134328.php')
-rw-r--r-- | app/DoctrineMigrations/Version20161118134328.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/DoctrineMigrations/Version20161118134328.php b/app/DoctrineMigrations/Version20161118134328.php index 69eae5a5..f168cb53 100644 --- a/app/DoctrineMigrations/Version20161118134328.php +++ b/app/DoctrineMigrations/Version20161118134328.php | |||
@@ -32,9 +32,14 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI | |||
32 | */ | 32 | */ |
33 | public function up(Schema $schema) | 33 | public function up(Schema $schema) |
34 | { | 34 | { |
35 | $this->skipIf($schema->getTable($this->getTable('entry'))->hasColumn('http_status'), 'It seems that you already played this migration.'); | 35 | $entryTable = $schema->getTable($this->getTable('entry')); |
36 | 36 | ||
37 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' ADD http_status VARCHAR(3) DEFAULT NULL'); | 37 | $this->skipIf($entryTable->hasColumn('http_status'), 'It seems that you already played this migration.'); |
38 | |||
39 | $entryTable->addColumn('http_status', 'string', [ | ||
40 | 'length' => 3, | ||
41 | 'notnull' => false, | ||
42 | ]); | ||
38 | } | 43 | } |
39 | 44 | ||
40 | /** | 45 | /** |
@@ -42,8 +47,7 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI | |||
42 | */ | 47 | */ |
43 | public function down(Schema $schema) | 48 | public function down(Schema $schema) |
44 | { | 49 | { |
45 | $this->skipIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.'); | 50 | $userTable = $schema->getTable($this->getTable('entry')); |
46 | 51 | $userTable->dropColumn('http_status'); | |
47 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' DROP http_status'); | ||
48 | } | 52 | } |
49 | } | 53 | } |