diff options
Diffstat (limited to 'app/DoctrineMigrations')
20 files changed, 351 insertions, 14 deletions
diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php index 6294d842..5e5cae35 100644 --- a/app/DoctrineMigrations/Version20160410190541.php +++ b/app/DoctrineMigrations/Version20160410190541.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added foreign keys for account resetting | 11 | * Added foreign keys for account resetting. |
12 | */ | 12 | */ |
13 | class Version20160410190541 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20160410190541 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php index bd6e8d63..13272267 100644 --- a/app/DoctrineMigrations/Version20160812120952.php +++ b/app/DoctrineMigrations/Version20160812120952.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added name field on wallabag_oauth2_clients | 11 | * Added name field on wallabag_oauth2_clients. |
12 | */ | 12 | */ |
13 | class Version20160812120952 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20160812120952 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20160911214952.php b/app/DoctrineMigrations/Version20160911214952.php index edef81ed..4eae46e7 100644 --- a/app/DoctrineMigrations/Version20160911214952.php +++ b/app/DoctrineMigrations/Version20160911214952.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added settings for RabbitMQ and Redis imports | 11 | * Added settings for RabbitMQ and Redis imports. |
12 | */ | 12 | */ |
13 | class Version20160911214952 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20160911214952 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php index 9f8e77e7..ff34c894 100644 --- a/app/DoctrineMigrations/Version20160916201049.php +++ b/app/DoctrineMigrations/Version20160916201049.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added pocket_consumer_key field on wallabag_config | 11 | * Added pocket_consumer_key field on wallabag_config. |
12 | */ | 12 | */ |
13 | class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php index f247c236..ad761541 100644 --- a/app/DoctrineMigrations/Version20161001072726.php +++ b/app/DoctrineMigrations/Version20161001072726.php | |||
@@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; | |||
9 | use Doctrine\DBAL\Migrations\SkipMigrationException; | 9 | use Doctrine\DBAL\Migrations\SkipMigrationException; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Added pocket_consumer_key field on wallabag_config | 12 | * Added pocket_consumer_key field on wallabag_config. |
13 | */ | 13 | */ |
14 | class Version20161001072726 extends AbstractMigration implements ContainerAwareInterface | 14 | class Version20161001072726 extends AbstractMigration implements ContainerAwareInterface |
15 | { | 15 | { |
diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php index c71166a0..39949e7d 100644 --- a/app/DoctrineMigrations/Version20161022134138.php +++ b/app/DoctrineMigrations/Version20161022134138.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Converted database to utf8mb4 encoding (for MySQL only) | 11 | * Converted database to utf8mb4 encoding (for MySQL only). |
12 | */ | 12 | */ |
13 | class Version20161022134138 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161022134138 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php index ecb872d1..b2f6aaf8 100644 --- a/app/DoctrineMigrations/Version20161024212538.php +++ b/app/DoctrineMigrations/Version20161024212538.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added user_id column on oauth2_clients to prevent users to delete API clients from other users | 11 | * Added user_id column on oauth2_clients to prevent users to delete API clients from other users. |
12 | */ | 12 | */ |
13 | class Version20161024212538 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161024212538 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161031132655.php b/app/DoctrineMigrations/Version20161031132655.php index 83b97ca9..ef846412 100644 --- a/app/DoctrineMigrations/Version20161031132655.php +++ b/app/DoctrineMigrations/Version20161031132655.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added the internal setting to enable/disable downloading pictures | 11 | * Added the internal setting to enable/disable downloading pictures. |
12 | */ | 12 | */ |
13 | class Version20161031132655 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161031132655 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161104073720.php b/app/DoctrineMigrations/Version20161104073720.php index fb8f5fa1..0e05f02e 100644 --- a/app/DoctrineMigrations/Version20161104073720.php +++ b/app/DoctrineMigrations/Version20161104073720.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added created_at index on entry table | 11 | * Added created_at index on entry table. |
12 | */ | 12 | */ |
13 | class Version20161104073720 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161104073720 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php index de3702a4..facc14f4 100644 --- a/app/DoctrineMigrations/Version20161106113822.php +++ b/app/DoctrineMigrations/Version20161106113822.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added action_mark_as_read field on config table | 11 | * Added action_mark_as_read field on config table. |
12 | */ | 12 | */ |
13 | class Version20161106113822 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161106113822 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161117071626.php b/app/DoctrineMigrations/Version20161117071626.php index 8daa2142..e779eacf 100644 --- a/app/DoctrineMigrations/Version20161117071626.php +++ b/app/DoctrineMigrations/Version20161117071626.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added the internal setting to share articles to unmark.it | 11 | * Added the internal setting to share articles to unmark.it. |
12 | */ | 12 | */ |
13 | class Version20161117071626 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161117071626 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161214094402.php b/app/DoctrineMigrations/Version20161214094402.php index db125f76..8ca32b09 100644 --- a/app/DoctrineMigrations/Version20161214094402.php +++ b/app/DoctrineMigrations/Version20161214094402.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Renamed uuid to uid in entry table | 11 | * Renamed uuid to uid in entry table. |
12 | */ | 12 | */ |
13 | class Version20161214094402 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161214094402 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20161214094403.php b/app/DoctrineMigrations/Version20161214094403.php index 5948b5fa..c7326f95 100644 --- a/app/DoctrineMigrations/Version20161214094403.php +++ b/app/DoctrineMigrations/Version20161214094403.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added index on wallabag_entry.uid | 11 | * Added index on wallabag_entry.uid. |
12 | */ | 12 | */ |
13 | class Version20161214094403 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20161214094403 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20170127093841.php b/app/DoctrineMigrations/Version20170127093841.php index 20c79479..5bfd9670 100644 --- a/app/DoctrineMigrations/Version20170127093841.php +++ b/app/DoctrineMigrations/Version20170127093841.php | |||
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Added indexes on wallabag_entry.is_starred and wallabag_entry.is_archived | 11 | * Added indexes on wallabag_entry.is_starred and wallabag_entry.is_archived. |
12 | */ | 12 | */ |
13 | class Version20170127093841 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20170127093841 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
diff --git a/app/DoctrineMigrations/Version20170327194233.php b/app/DoctrineMigrations/Version20170327194233.php new file mode 100644 index 00000000..e1466b2f --- /dev/null +++ b/app/DoctrineMigrations/Version20170327194233.php | |||
@@ -0,0 +1,54 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Add the share_scuttle internal setting. | ||
12 | */ | ||
13 | class Version20170327194233 extends AbstractMigration implements ContainerAwareInterface | ||
14 | { | ||
15 | /** | ||
16 | * @var ContainerInterface | ||
17 | */ | ||
18 | private $container; | ||
19 | |||
20 | public function setContainer(ContainerInterface $container = null) | ||
21 | { | ||
22 | $this->container = $container; | ||
23 | } | ||
24 | |||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Schema $schema | ||
32 | */ | ||
33 | public function up(Schema $schema) | ||
34 | { | ||
35 | $scuttle = $this->container | ||
36 | ->get('doctrine.orm.default_entity_manager') | ||
37 | ->getConnection() | ||
38 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_scuttle'"); | ||
39 | |||
40 | $this->skipIf(false !== $scuttle, 'It seems that you already played this migration.'); | ||
41 | |||
42 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_scuttle', '1', 'entry')"); | ||
43 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * @param Schema $schema | ||
48 | */ | ||
49 | public function down(Schema $schema) | ||
50 | { | ||
51 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_scuttle';"); | ||
52 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'scuttle_url';"); | ||
53 | } | ||
54 | } | ||
diff --git a/app/DoctrineMigrations/Version20170405182620.php b/app/DoctrineMigrations/Version20170405182620.php new file mode 100644 index 00000000..3ef9633f --- /dev/null +++ b/app/DoctrineMigrations/Version20170405182620.php | |||
@@ -0,0 +1,65 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Add published_at and published_by in `entry` table. | ||
12 | */ | ||
13 | class Version20170405182620 extends AbstractMigration implements ContainerAwareInterface | ||
14 | { | ||
15 | /** | ||
16 | * @var ContainerInterface | ||
17 | */ | ||
18 | private $container; | ||
19 | |||
20 | public function setContainer(ContainerInterface $container = null) | ||
21 | { | ||
22 | $this->container = $container; | ||
23 | } | ||
24 | |||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Schema $schema | ||
32 | */ | ||
33 | public function up(Schema $schema) | ||
34 | { | ||
35 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
36 | |||
37 | $this->skipIf($entryTable->hasColumn('published_at'), 'It seems that you already played this migration.'); | ||
38 | |||
39 | $entryTable->addColumn('published_at', 'datetime', [ | ||
40 | 'notnull' => false, | ||
41 | ]); | ||
42 | |||
43 | $this->skipIf($entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); | ||
44 | |||
45 | $entryTable->addColumn('published_by', 'text', [ | ||
46 | 'notnull' => false, | ||
47 | ]); | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * @param Schema $schema | ||
52 | */ | ||
53 | public function down(Schema $schema) | ||
54 | { | ||
55 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
56 | |||
57 | $this->skipIf(!$entryTable->hasColumn('published_at'), 'It seems that you already played this migration.'); | ||
58 | |||
59 | $entryTable->dropColumn('published_at'); | ||
60 | |||
61 | $this->skipIf(!$entryTable->hasColumn('published_by'), 'It seems that you already played this migration.'); | ||
62 | |||
63 | $entryTable->dropColumn('published_by'); | ||
64 | } | ||
65 | } | ||
diff --git a/app/DoctrineMigrations/Version20170407200919.php b/app/DoctrineMigrations/Version20170407200919.php new file mode 100644 index 00000000..4b9d475a --- /dev/null +++ b/app/DoctrineMigrations/Version20170407200919.php | |||
@@ -0,0 +1,51 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Remove isPublic in Entry Table. | ||
12 | */ | ||
13 | class Version20170407200919 extends AbstractMigration implements ContainerAwareInterface | ||
14 | { | ||
15 | /** | ||
16 | * @var ContainerInterface | ||
17 | */ | ||
18 | private $container; | ||
19 | |||
20 | public function setContainer(ContainerInterface $container = null) | ||
21 | { | ||
22 | $this->container = $container; | ||
23 | } | ||
24 | |||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Schema $schema | ||
32 | */ | ||
33 | public function up(Schema $schema) | ||
34 | { | ||
35 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
36 | $this->skipIf(!$entryTable->hasColumn('is_public'), 'It seems that you already played this migration.'); | ||
37 | |||
38 | $entryTable->dropColumn('is_public'); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * @param Schema $schema | ||
43 | */ | ||
44 | public function down(Schema $schema) | ||
45 | { | ||
46 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
47 | $this->skipIf($entryTable->hasColumn('is_public'), 'It seems that you already played this migration.'); | ||
48 | |||
49 | $entryTable->addColumn('is_public', 'boolean', ['notnull' => false, 'default' => 0]); | ||
50 | } | ||
51 | } | ||
diff --git a/app/DoctrineMigrations/Version20170420134133.php b/app/DoctrineMigrations/Version20170420134133.php new file mode 100644 index 00000000..b1ab7bcb --- /dev/null +++ b/app/DoctrineMigrations/Version20170420134133.php | |||
@@ -0,0 +1,52 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Remove download_pictures in craue_config_setting. | ||
12 | */ | ||
13 | class Version20170420134133 extends AbstractMigration implements ContainerAwareInterface | ||
14 | { | ||
15 | /** | ||
16 | * @var ContainerInterface | ||
17 | */ | ||
18 | private $container; | ||
19 | |||
20 | public function setContainer(ContainerInterface $container = null) | ||
21 | { | ||
22 | $this->container = $container; | ||
23 | } | ||
24 | |||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Schema $schema | ||
32 | */ | ||
33 | public function up(Schema $schema) | ||
34 | { | ||
35 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures';"); | ||
36 | } | ||
37 | |||
38 | /** | ||
39 | * @param Schema $schema | ||
40 | */ | ||
41 | public function down(Schema $schema) | ||
42 | { | ||
43 | $downloadPictures = $this->container | ||
44 | ->get('doctrine.orm.default_entity_manager') | ||
45 | ->getConnection() | ||
46 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures'"); | ||
47 | |||
48 | $this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.'); | ||
49 | |||
50 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_pictures', '1', 'entry')"); | ||
51 | } | ||
52 | } | ||
diff --git a/app/DoctrineMigrations/Version20170510082609.php b/app/DoctrineMigrations/Version20170510082609.php new file mode 100644 index 00000000..a99af2d2 --- /dev/null +++ b/app/DoctrineMigrations/Version20170510082609.php | |||
@@ -0,0 +1,60 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Changed length for username, username_canonical, email and email_canonical fields in wallabag_user table. | ||
12 | */ | ||
13 | class Version20170510082609 extends AbstractMigration implements ContainerAwareInterface | ||
14 | { | ||
15 | private $fields = [ | ||
16 | 'username', | ||
17 | 'username_canonical', | ||
18 | 'email', | ||
19 | 'email_canonical', | ||
20 | ]; | ||
21 | |||
22 | /** | ||
23 | * @var ContainerInterface | ||
24 | */ | ||
25 | private $container; | ||
26 | |||
27 | public function setContainer(ContainerInterface $container = null) | ||
28 | { | ||
29 | $this->container = $container; | ||
30 | } | ||
31 | |||
32 | private function getTable($tableName) | ||
33 | { | ||
34 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
35 | } | ||
36 | |||
37 | /** | ||
38 | * @param Schema $schema | ||
39 | */ | ||
40 | public function up(Schema $schema) | ||
41 | { | ||
42 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); | ||
43 | |||
44 | foreach ($this->fields as $field) { | ||
45 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(180) NOT NULL;'); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * @param Schema $schema | ||
51 | */ | ||
52 | public function down(Schema $schema) | ||
53 | { | ||
54 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); | ||
55 | |||
56 | foreach ($this->fields as $field) { | ||
57 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(255) NOT NULL;'); | ||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/app/DoctrineMigrations/Version20170511115400.php b/app/DoctrineMigrations/Version20170511115400.php new file mode 100644 index 00000000..64ee9e0a --- /dev/null +++ b/app/DoctrineMigrations/Version20170511115400.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Added `headers` field in entry table. | ||
12 | */ | ||
13 | class Version20170511115400 extends AbstractMigration implements ContainerAwareInterface | ||
14 | { | ||
15 | /** | ||
16 | * @var ContainerInterface | ||
17 | */ | ||
18 | private $container; | ||
19 | |||
20 | public function setContainer(ContainerInterface $container = null) | ||
21 | { | ||
22 | $this->container = $container; | ||
23 | } | ||
24 | |||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Schema $schema | ||
32 | */ | ||
33 | public function up(Schema $schema) | ||
34 | { | ||
35 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
36 | |||
37 | $this->skipIf($entryTable->hasColumn('headers'), 'It seems that you already played this migration.'); | ||
38 | |||
39 | $entryTable->addColumn('headers', 'text', [ | ||
40 | 'notnull' => false, | ||
41 | ]); | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * @param Schema $schema | ||
46 | */ | ||
47 | public function down(Schema $schema) | ||
48 | { | ||
49 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
50 | |||
51 | $this->skipIf(!$entryTable->hasColumn('headers'), 'It seems that you already played this migration.'); | ||
52 | |||
53 | $entryTable->dropColumn('headers'); | ||
54 | } | ||
55 | } | ||