aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/DoctrineMigrations/Version20160410190541.php19
-rw-r--r--app/DoctrineMigrations/Version20160812120952.php21
-rw-r--r--app/DoctrineMigrations/Version20160911214952.php6
-rw-r--r--app/DoctrineMigrations/Version20160916201049.php15
4 files changed, 26 insertions, 35 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}
diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php
index a5d11e3f..053b8d88 100644
--- a/app/DoctrineMigrations/Version20160812120952.php
+++ b/app/DoctrineMigrations/Version20160812120952.php
@@ -29,20 +29,10 @@ class Version20160812120952 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('oauth2_clients'))->hasColumn('name'), 'It seems that you already played this migration.'); 32 $clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
33 $this->skipIf($clientsTable->hasColumn('name'), 'It seems that you already played this migration.');
33 34
34 switch ($this->connection->getDatabasePlatform()->getName()) { 35 $clientsTable->addColumn('name', 'blob');
35 case 'sqlite':
36 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext DEFAULT NULL');
37 break;
38
39 case 'mysql':
40 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext COLLATE \'utf8_unicode_ci\' DEFAULT NULL');
41 break;
42
43 case 'postgresql':
44 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name text DEFAULT NULL');
45 }
46 } 36 }
47 37
48 /** 38 /**
@@ -50,8 +40,7 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
50 */ 40 */
51 public function down(Schema $schema) 41 public function down(Schema $schema)
52 { 42 {
53 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); 43 $clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
54 44 $clientsTable->dropColumn('name');
55 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' DROP COLUMN name');
56 } 45 }
57} 46}
diff --git a/app/DoctrineMigrations/Version20160911214952.php b/app/DoctrineMigrations/Version20160911214952.php
index 53e5cf85..963821ae 100644
--- a/app/DoctrineMigrations/Version20160911214952.php
+++ b/app/DoctrineMigrations/Version20160911214952.php
@@ -29,8 +29,8 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI
29 */ 29 */
30 public function up(Schema $schema) 30 public function up(Schema $schema)
31 { 31 {
32 $this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting').'" (name, value, section) VALUES (\'import_with_redis\', \'0\', \'import\')'); 32 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_redis', 0, 'import')");
33 $this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting').'" (name, value, section) VALUES (\'import_with_rabbitmq\', \'0\', \'import\')'); 33 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_rabbitmq', 0, 'import')");
34 } 34 }
35 35
36 /** 36 /**
@@ -38,5 +38,7 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI
38 */ 38 */
39 public function down(Schema $schema) 39 public function down(Schema $schema)
40 { 40 {
41 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_redis';");
42 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_rabbitmq';");
41 } 43 }
42} 44}
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php
index 83ed6b61..09c05f4b 100644
--- a/app/DoctrineMigrations/Version20160916201049.php
+++ b/app/DoctrineMigrations/Version20160916201049.php
@@ -29,10 +29,12 @@ class Version20160916201049 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('config'))->hasColumn('pocket_consumer_key'), 'It seems that you already played this migration.'); 32 $configTable = $schema->getTable($this->getTable('config'));
33 33
34 $this->addSql('ALTER TABLE "'.$this->getTable('config').'" ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL'); 34 $this->skipIf($configTable->hasColumn('pocket_consumer_key'), 'It seems that you already played this migration.');
35 $this->addSql('DELETE FROM "'.$this->getTable('craue_config_setting')."\" WHERE name = 'pocket_consumer_key';"); 35
36 $userTable->addColumn('pocket_consumer_key', 'string');
37 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'pocket_consumer_key';");
36 } 38 }
37 39
38 /** 40 /**
@@ -40,9 +42,8 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI
40 */ 42 */
41 public function down(Schema $schema) 43 public function down(Schema $schema)
42 { 44 {
43 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); 45 $configTable = $schema->getTable($this->getTable('config'));
44 46 $clientsTable->dropColumn('pocket_consumer_key');
45 $this->addSql('ALTER TABLE "'.$this->getTable('config').'" DROP pocket_consumer_key'); 47 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')");
46 $this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')");
47 } 48 }
48} 49}