diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/DoctrineMigrations/Version20161001072726.php | 1 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20161024212538.php | 16 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20161106113822.php | 5 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20161118134328.php | 7 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20161122203647.php | 7 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20161128131503.php | 2 |
6 files changed, 30 insertions, 8 deletions
diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php index b5d104cd..f247c236 100644 --- a/app/DoctrineMigrations/Version20161001072726.php +++ b/app/DoctrineMigrations/Version20161001072726.php | |||
@@ -6,6 +6,7 @@ use Doctrine\DBAL\Migrations\AbstractMigration; | |||
6 | use Doctrine\DBAL\Schema\Schema; | 6 | use Doctrine\DBAL\Schema\Schema; |
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | 7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; |
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | use Doctrine\DBAL\Migrations\SkipMigrationException; | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * Added pocket_consumer_key field on wallabag_config | 12 | * Added pocket_consumer_key field on wallabag_config |
diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php index 0c5a53da..ecb872d1 100644 --- a/app/DoctrineMigrations/Version20161024212538.php +++ b/app/DoctrineMigrations/Version20161024212538.php | |||
@@ -17,6 +17,8 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI | |||
17 | */ | 17 | */ |
18 | private $container; | 18 | private $container; |
19 | 19 | ||
20 | private $constraintName = 'IDX_user_oauth_client'; | ||
21 | |||
20 | public function setContainer(ContainerInterface $container = null) | 22 | public function setContainer(ContainerInterface $container = null) |
21 | { | 23 | { |
22 | $this->container = $container; | 24 | $this->container = $container; |
@@ -36,13 +38,14 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI | |||
36 | 38 | ||
37 | $this->skipIf($clientsTable->hasColumn('user_id'), 'It seems that you already played this migration.'); | 39 | $this->skipIf($clientsTable->hasColumn('user_id'), 'It seems that you already played this migration.'); |
38 | 40 | ||
39 | $clientsTable->addColumn('user_id', 'integer'); | 41 | $clientsTable->addColumn('user_id', 'integer', ['notnull' => false]); |
40 | 42 | ||
41 | $clientsTable->addForeignKeyConstraint( | 43 | $clientsTable->addForeignKeyConstraint( |
42 | $this->getTable('user'), | 44 | $this->getTable('user'), |
43 | ['user_id'], | 45 | ['user_id'], |
44 | ['id'], | 46 | ['id'], |
45 | ['onDelete' => 'CASCADE'] | 47 | ['onDelete' => 'CASCADE'], |
48 | $this->constraintName | ||
46 | ); | 49 | ); |
47 | } | 50 | } |
48 | 51 | ||
@@ -51,5 +54,14 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI | |||
51 | */ | 54 | */ |
52 | public function down(Schema $schema) | 55 | public function down(Schema $schema) |
53 | { | 56 | { |
57 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); | ||
58 | |||
59 | $this->skipIf(!$clientsTable->hasColumn('user_id'), 'It seems that you already played this migration.'); | ||
60 | |||
61 | $clientsTable->dropColumn('user_id', 'integer'); | ||
62 | |||
63 | if ($this->connection->getDatabasePlatform()->getName() != 'sqlite') { | ||
64 | $clientsTable->removeForeignKey($this->constraintName); | ||
65 | } | ||
54 | } | 66 | } |
55 | } | 67 | } |
diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php index faa2d9fd..de3702a4 100644 --- a/app/DoctrineMigrations/Version20161106113822.php +++ b/app/DoctrineMigrations/Version20161106113822.php | |||
@@ -48,6 +48,9 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI | |||
48 | public function down(Schema $schema) | 48 | public function down(Schema $schema) |
49 | { | 49 | { |
50 | $configTable = $schema->getTable($this->getTable('config')); | 50 | $configTable = $schema->getTable($this->getTable('config')); |
51 | $userTable->dropColumn('action_mark_as_read'); | 51 | |
52 | $this->skipIf(!$configTable->hasColumn('action_mark_as_read'), 'It seems that you already played this migration.'); | ||
53 | |||
54 | $configTable->dropColumn('action_mark_as_read'); | ||
52 | } | 55 | } |
53 | } | 56 | } |
diff --git a/app/DoctrineMigrations/Version20161118134328.php b/app/DoctrineMigrations/Version20161118134328.php index f168cb53..7b2eeb7b 100644 --- a/app/DoctrineMigrations/Version20161118134328.php +++ b/app/DoctrineMigrations/Version20161118134328.php | |||
@@ -47,7 +47,10 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI | |||
47 | */ | 47 | */ |
48 | public function down(Schema $schema) | 48 | public function down(Schema $schema) |
49 | { | 49 | { |
50 | $userTable = $schema->getTable($this->getTable('entry')); | 50 | $entryTable = $schema->getTable($this->getTable('entry')); |
51 | $userTable->dropColumn('http_status'); | 51 | |
52 | $this->skipIf(!$entryTable->hasColumn('http_status'), 'It seems that you already played this migration.'); | ||
53 | |||
54 | $entryTable->dropColumn('http_status'); | ||
52 | } | 55 | } |
53 | } | 56 | } |
diff --git a/app/DoctrineMigrations/Version20161122203647.php b/app/DoctrineMigrations/Version20161122203647.php index 94197193..9b17d6ef 100644 --- a/app/DoctrineMigrations/Version20161122203647.php +++ b/app/DoctrineMigrations/Version20161122203647.php | |||
@@ -54,7 +54,10 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI | |||
54 | public function down(Schema $schema) | 54 | public function down(Schema $schema) |
55 | { | 55 | { |
56 | $userTable = $schema->getTable($this->getTable('user')); | 56 | $userTable = $schema->getTable($this->getTable('user')); |
57 | $userTable->addColumn('expired', 'smallint'); | 57 | |
58 | $userTable->addColumn('credentials_expired', 'smallint'); | 58 | $this->skipIf(true === $userTable->hasColumn('expired') || true === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.'); |
59 | |||
60 | $userTable->addColumn('expired', 'smallint', ['notnull' => false]); | ||
61 | $userTable->addColumn('credentials_expired', 'smallint', ['notnull' => false]); | ||
59 | } | 62 | } |
60 | } | 63 | } |
diff --git a/app/DoctrineMigrations/Version20161128131503.php b/app/DoctrineMigrations/Version20161128131503.php index f0e016c8..b71aa38b 100644 --- a/app/DoctrineMigrations/Version20161128131503.php +++ b/app/DoctrineMigrations/Version20161128131503.php | |||
@@ -55,7 +55,7 @@ class Version20161128131503 extends AbstractMigration implements ContainerAwareI | |||
55 | 55 | ||
56 | foreach ($this->fields as $field => $type) { | 56 | foreach ($this->fields as $field => $type) { |
57 | $this->skipIf($userTable->hasColumn($field), 'It seems that you already played this migration.'); | 57 | $this->skipIf($userTable->hasColumn($field), 'It seems that you already played this migration.'); |
58 | $userTable->addColumn($field, $type); | 58 | $userTable->addColumn($field, $type, ['notnull' => false]); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | } | 61 | } |