diff options
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 | } |