aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-25 17:43:28 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-28 14:28:35 +0100
commit18d7bc3a353d8737c64a0f9e1c9fdcb7a756c3e5 (patch)
tree0127c73f45fc5341e42882a421fbd01417a0f721 /app/DoctrineMigrations
parent986cb536457e921dacf7ab5c7bc16ad4b2108781 (diff)
downloadwallabag-18d7bc3a353d8737c64a0f9e1c9fdcb7a756c3e5.tar.gz
wallabag-18d7bc3a353d8737c64a0f9e1c9fdcb7a756c3e5.tar.zst
wallabag-18d7bc3a353d8737c64a0f9e1c9fdcb7a756c3e5.zip
Added checks on migrations
Diffstat (limited to 'app/DoctrineMigrations')
-rw-r--r--app/DoctrineMigrations/Version20160812120952.php4
-rw-r--r--app/DoctrineMigrations/Version20160916201049.php8
-rw-r--r--app/DoctrineMigrations/Version20161024212538.php5
-rw-r--r--app/DoctrineMigrations/Version20161106113822.php4
-rw-r--r--app/DoctrineMigrations/Version20161118134328.php6
-rw-r--r--app/DoctrineMigrations/Version20161122203647.php9
6 files changed, 25 insertions, 11 deletions
diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php
index 39423e2f..3ed1b798 100644
--- a/app/DoctrineMigrations/Version20160812120952.php
+++ b/app/DoctrineMigrations/Version20160812120952.php
@@ -21,7 +21,7 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
21 21
22 private function getTable($tableName) 22 private function getTable($tableName)
23 { 23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName; 24 return $this->container->getParameter('database_table_prefix').$tableName;
25 } 25 }
26 26
27 /** 27 /**
@@ -29,6 +29,8 @@ 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.');
33
32 switch ($this->connection->getDatabasePlatform()->getName()) { 34 switch ($this->connection->getDatabasePlatform()->getName()) {
33 case 'sqlite': 35 case 'sqlite':
34 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext DEFAULT NULL'); 36 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext DEFAULT NULL');
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php
index 0d2edf9e..5db00108 100644
--- a/app/DoctrineMigrations/Version20160916201049.php
+++ b/app/DoctrineMigrations/Version20160916201049.php
@@ -21,7 +21,7 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI
21 21
22 private function getTable($tableName) 22 private function getTable($tableName)
23 { 23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName; 24 return $this->container->getParameter('database_table_prefix').$tableName;
25 } 25 }
26 26
27 /** 27 /**
@@ -29,8 +29,10 @@ 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.');
33
32 $this->addSql('ALTER TABLE "'.$this->getTable('config').'" ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL'); 34 $this->addSql('ALTER TABLE "'.$this->getTable('config').'" ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL');
33 $this->addSql("DELETE FROM \"".$this->getTable('craue_config_setting')."\" WHERE name = 'pocket_consumer_key';"); 35 $this->addSql('DELETE FROM "'.$this->getTable('craue_config_setting')."\" WHERE name = 'pocket_consumer_key';");
34 } 36 }
35 37
36 /** 38 /**
@@ -41,6 +43,6 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI
41 $this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); 43 $this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
42 44
43 $this->addSql('ALTER TABLE "'.$this->getTable('config').'" DROP pocket_consumer_key'); 45 $this->addSql('ALTER TABLE "'.$this->getTable('config').'" DROP pocket_consumer_key');
44 $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')");
45 } 47 }
46} 48}
diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php
index f8e927e4..ced3a802 100644
--- a/app/DoctrineMigrations/Version20161024212538.php
+++ b/app/DoctrineMigrations/Version20161024212538.php
@@ -21,7 +21,7 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI
21 21
22 private function getTable($tableName) 22 private function getTable($tableName)
23 { 23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName; 24 return $this->container->getParameter('database_table_prefix').$tableName;
25 } 25 }
26 26
27 /** 27 /**
@@ -31,6 +31,8 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI
31 { 31 {
32 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); 32 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
33 33
34 $this->skipIf($schema->getTable($this->getTable('oauth2_clients'))->hasColumn('user_id'), 'It seems that you already played this migration.');
35
34 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD user_id INT(11) DEFAULT NULL'); 36 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD user_id INT(11) DEFAULT NULL');
35 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD CONSTRAINT FK_clients_user_clients FOREIGN KEY (user_id) REFERENCES '.$this->getTable('user').' (id) ON DELETE CASCADE'); 37 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD CONSTRAINT FK_clients_user_clients FOREIGN KEY (user_id) REFERENCES '.$this->getTable('user').' (id) ON DELETE CASCADE');
36 } 38 }
@@ -40,6 +42,5 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI
40 */ 42 */
41 public function down(Schema $schema) 43 public function down(Schema $schema)
42 { 44 {
43
44 } 45 }
45} 46}
diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php
index edca54f5..a5401b2c 100644
--- a/app/DoctrineMigrations/Version20161106113822.php
+++ b/app/DoctrineMigrations/Version20161106113822.php
@@ -21,7 +21,7 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI
21 21
22 private function getTable($tableName) 22 private function getTable($tableName)
23 { 23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName; 24 return $this->container->getParameter('database_table_prefix').$tableName;
25 } 25 }
26 26
27 /** 27 /**
@@ -29,6 +29,8 @@ class Version20161106113822 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('action_mark_as_read'), 'It seems that you already played this migration.');
33
32 $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD action_mark_as_read INT DEFAULT 0'); 34 $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD action_mark_as_read INT DEFAULT 0');
33 } 35 }
34 36
diff --git a/app/DoctrineMigrations/Version20161118134328.php b/app/DoctrineMigrations/Version20161118134328.php
index 390e89ce..76dd9074 100644
--- a/app/DoctrineMigrations/Version20161118134328.php
+++ b/app/DoctrineMigrations/Version20161118134328.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Add http_status in `entry_table` 11 * Add http_status in `entry_table`.
12 */ 12 */
13class Version20161118134328 extends AbstractMigration implements ContainerAwareInterface 13class Version20161118134328 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
@@ -24,7 +24,7 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI
24 24
25 private function getTable($tableName) 25 private function getTable($tableName)
26 { 26 {
27 return $this->container->getParameter('database_table_prefix') . $tableName; 27 return $this->container->getParameter('database_table_prefix').$tableName;
28 } 28 }
29 29
30 /** 30 /**
@@ -32,6 +32,8 @@ 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.');
36
35 $this->addSql('ALTER TABLE '.$this->getTable('entry').' ADD http_status VARCHAR(3) DEFAULT NULL'); 37 $this->addSql('ALTER TABLE '.$this->getTable('entry').' ADD http_status VARCHAR(3) DEFAULT NULL');
36 } 38 }
37 39
diff --git a/app/DoctrineMigrations/Version20161122203647.php b/app/DoctrineMigrations/Version20161122203647.php
index ea2703b6..2cb990e1 100644
--- a/app/DoctrineMigrations/Version20161122203647.php
+++ b/app/DoctrineMigrations/Version20161122203647.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Methods and properties removed from `FOS\UserBundle\Model\User` 11 * Methods and properties removed from `FOS\UserBundle\Model\User`.
12 * 12 *
13 * - `$expired` 13 * - `$expired`
14 * - `$credentialsExpired` 14 * - `$credentialsExpired`
@@ -32,7 +32,7 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI
32 32
33 private function getTable($tableName) 33 private function getTable($tableName)
34 { 34 {
35 return $this->container->getParameter('database_table_prefix') . $tableName; 35 return $this->container->getParameter('database_table_prefix').$tableName;
36 } 36 }
37 37
38 /** 38 /**
@@ -42,7 +42,12 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI
42 { 42 {
43 $this->abortIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'This up migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.'); 43 $this->abortIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'This up migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
44 44
45 $this->skipIf(false === $schema->getTable($this->getTable('user'))->hasColumn('expired'), 'It seems that you already played this migration.');
46
45 $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP expired'); 47 $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP expired');
48
49 $this->skipIf(false === $schema->getTable($this->getTable('user'))->hasColumn('credentials_expired'), 'It seems that you already played this migration.');
50
46 $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP credentials_expired'); 51 $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP credentials_expired');
47 } 52 }
48 53