aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations/Version20160410190541.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-26 16:06:14 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-28 14:28:35 +0100
commit597755b8c7f45310df072d2185fc7bd406f9a39e (patch)
tree08ec6e1c336599bee73d1fe096d3cf53433e5143 /app/DoctrineMigrations/Version20160410190541.php
parent84c6a48df412af7a15a63de5484c4bbcf27de33e (diff)
downloadwallabag-597755b8c7f45310df072d2185fc7bd406f9a39e.tar.gz
wallabag-597755b8c7f45310df072d2185fc7bd406f9a39e.tar.zst
wallabag-597755b8c7f45310df072d2185fc7bd406f9a39e.zip
Cleaned old migrations
Diffstat (limited to 'app/DoctrineMigrations/Version20160410190541.php')
-rw-r--r--app/DoctrineMigrations/Version20160410190541.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php
index c2360937..0cdec008 100644
--- a/app/DoctrineMigrations/Version20160410190541.php
+++ b/app/DoctrineMigrations/Version20160410190541.php
@@ -29,15 +29,14 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI
29 */ 29 */
30 public function up(Schema $schema) 30 public function up(Schema $schema)
31 { 31 {
32 $this->skipIf($schema->getTable($this->getTable('entry'))->hasColumn('uuid'), 'It seems that you already played this migration.'); 32 $entryTable = $schema->getTable($this->getTable('entry'));
33 33
34 if ($this->connection->getDatabasePlatform()->getName() == 'postgresql') { 34 $this->skipIf($entryTable->hasColumn('uuid'), 'It seems that you already played this migration.');
35 $this->addSql('ALTER TABLE "'.$this->getTable('entry').'" ADD uuid UUID DEFAULT NULL');
36 } else {
37 $this->addSql('ALTER TABLE "'.$this->getTable('entry').'" ADD uuid LONGTEXT DEFAULT NULL');
38 }
39 35
40 $this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('share_public', '1', 'entry')"); 36 $entryTable->addColumn('uuid', 'guid', [
37 'notnull' => false,
38 ]);
39 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_public', '1', 'entry')");
41 } 40 }
42 41
43 /** 42 /**
@@ -45,9 +44,9 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI
45 */ 44 */
46 public function down(Schema $schema) 45 public function down(Schema $schema)
47 { 46 {
48 $this->skipIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.'); 47 $entryTable = $schema->getTable($this->getTable('entry'));
48 $entryTable->dropColumn('uuid');
49 49
50 $this->addSql('ALTER TABLE "'.$this->getTable('entry').'" DROP uuid'); 50 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_public'");
51 $this->addSql('DELETE FROM "'.$this->getTable('craue_config_setting')."\" WHERE name = 'share_public'");
52 } 51 }
53} 52}