diff options
author | lizyn <zhiylin@outlook.com> | 2020-02-24 10:04:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 10:04:13 +0800 |
commit | b19df31d78d881a43bcf6b3215e5fc3781e8e8aa (patch) | |
tree | d0d9861694a4b5e5fbfdbeb53c255ecd15fe9328 /app/DoctrineMigrations | |
parent | 4d0c632c70ea50d459c3c55ddda2e0f394dd51cb (diff) | |
parent | 04d918cae0227c06a41d27fb6533dddbf30dfe71 (diff) | |
download | wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.gz wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.zst wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.zip |
Merge pull request #1 from wallabag/master
Keep up with the master again
Diffstat (limited to 'app/DoctrineMigrations')
50 files changed, 863 insertions, 222 deletions
diff --git a/app/DoctrineMigrations/Version20160401000000.php b/app/DoctrineMigrations/Version20160401000000.php index c80e3e1f..9417935b 100644 --- a/app/DoctrineMigrations/Version20160401000000.php +++ b/app/DoctrineMigrations/Version20160401000000.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20160401000000 extends WallabagMigration | 11 | class Version20160401000000 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $this->skipIf($schema->hasTable($this->getTable('entry')), 'Database already initialized'); | 15 | $this->skipIf($schema->hasTable($this->getTable('entry')), 'Database already initialized'); |
@@ -167,9 +164,6 @@ SQL | |||
167 | } | 164 | } |
168 | } | 165 | } |
169 | 166 | ||
170 | /** | ||
171 | * @param Schema $schema | ||
172 | */ | ||
173 | public function down(Schema $schema) | 167 | public function down(Schema $schema) |
174 | { | 168 | { |
175 | $this->addSql("DROP TABLE {$this->getTable('craue_config_setting')}"); | 169 | $this->addSql("DROP TABLE {$this->getTable('craue_config_setting')}"); |
diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php index e1bd3e5c..5b6d83dc 100644 --- a/app/DoctrineMigrations/Version20160410190541.php +++ b/app/DoctrineMigrations/Version20160410190541.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20160410190541 extends WallabagMigration | 11 | class Version20160410190541 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -34,9 +31,6 @@ class Version20160410190541 extends WallabagMigration | |||
34 | } | 31 | } |
35 | } | 32 | } |
36 | 33 | ||
37 | /** | ||
38 | * @param Schema $schema | ||
39 | */ | ||
40 | public function down(Schema $schema) | 34 | public function down(Schema $schema) |
41 | { | 35 | { |
42 | $entryTable = $schema->getTable($this->getTable('entry')); | 36 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php index d09aefa0..f5f90850 100644 --- a/app/DoctrineMigrations/Version20160812120952.php +++ b/app/DoctrineMigrations/Version20160812120952.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20160812120952 extends WallabagMigration | 11 | class Version20160812120952 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); | 15 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); |
@@ -34,9 +31,6 @@ class Version20160812120952 extends WallabagMigration | |||
34 | } | 31 | } |
35 | } | 32 | } |
36 | 33 | ||
37 | /** | ||
38 | * @param Schema $schema | ||
39 | */ | ||
40 | public function down(Schema $schema) | 34 | public function down(Schema $schema) |
41 | { | 35 | { |
42 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); | 36 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); |
diff --git a/app/DoctrineMigrations/Version20160911214952.php b/app/DoctrineMigrations/Version20160911214952.php index 9dc225fd..4d7e0f7e 100644 --- a/app/DoctrineMigrations/Version20160911214952.php +++ b/app/DoctrineMigrations/Version20160911214952.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20160911214952 extends WallabagMigration | 11 | class Version20160911214952 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $redis = $this->container | 15 | $redis = $this->container |
@@ -36,9 +33,6 @@ class Version20160911214952 extends WallabagMigration | |||
36 | $this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.'); | 33 | $this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.'); |
37 | } | 34 | } |
38 | 35 | ||
39 | /** | ||
40 | * @param Schema $schema | ||
41 | */ | ||
42 | public function down(Schema $schema) | 36 | public function down(Schema $schema) |
43 | { | 37 | { |
44 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis';"); | 38 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis';"); |
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php index 13f99ce1..fc5e04ae 100644 --- a/app/DoctrineMigrations/Version20160916201049.php +++ b/app/DoctrineMigrations/Version20160916201049.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20160916201049 extends WallabagMigration | 11 | class Version20160916201049 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $configTable = $schema->getTable($this->getTable('config')); | 15 | $configTable = $schema->getTable($this->getTable('config')); |
@@ -23,9 +20,6 @@ class Version20160916201049 extends WallabagMigration | |||
23 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'pocket_consumer_key';"); | 20 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'pocket_consumer_key';"); |
24 | } | 21 | } |
25 | 22 | ||
26 | /** | ||
27 | * @param Schema $schema | ||
28 | */ | ||
29 | public function down(Schema $schema) | 23 | public function down(Schema $schema) |
30 | { | 24 | { |
31 | $configTable = $schema->getTable($this->getTable('config')); | 25 | $configTable = $schema->getTable($this->getTable('config')); |
diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php index 4e19a54a..497cb2a1 100644 --- a/app/DoctrineMigrations/Version20161001072726.php +++ b/app/DoctrineMigrations/Version20161001072726.php | |||
@@ -11,9 +11,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
11 | */ | 11 | */ |
12 | class Version20161001072726 extends WallabagMigration | 12 | class Version20161001072726 extends WallabagMigration |
13 | { | 13 | { |
14 | /** | ||
15 | * @param Schema $schema | ||
16 | */ | ||
17 | public function up(Schema $schema) | 14 | public function up(Schema $schema) |
18 | { | 15 | { |
19 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); | 16 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); |
@@ -98,9 +95,6 @@ class Version20161001072726 extends WallabagMigration | |||
98 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES ' . $this->getTable('entry') . ' (id) ON DELETE CASCADE'); | 95 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES ' . $this->getTable('entry') . ' (id) ON DELETE CASCADE'); |
99 | } | 96 | } |
100 | 97 | ||
101 | /** | ||
102 | * @param Schema $schema | ||
103 | */ | ||
104 | public function down(Schema $schema) | 98 | public function down(Schema $schema) |
105 | { | 99 | { |
106 | throw new SkipMigrationException('Too complex ...'); | 100 | throw new SkipMigrationException('Too complex ...'); |
diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php index 231aada7..d993363c 100644 --- a/app/DoctrineMigrations/Version20161022134138.php +++ b/app/DoctrineMigrations/Version20161022134138.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161022134138 extends WallabagMigration | 11 | class Version20161022134138 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); | 15 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); |
@@ -41,9 +38,6 @@ class Version20161022134138 extends WallabagMigration | |||
41 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 38 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
42 | } | 39 | } |
43 | 40 | ||
44 | /** | ||
45 | * @param Schema $schema | ||
46 | */ | ||
47 | public function down(Schema $schema) | 41 | public function down(Schema $schema) |
48 | { | 42 | { |
49 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); | 43 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); |
diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php index a7e3c3c8..fa028ac0 100644 --- a/app/DoctrineMigrations/Version20161024212538.php +++ b/app/DoctrineMigrations/Version20161024212538.php | |||
@@ -12,9 +12,6 @@ class Version20161024212538 extends WallabagMigration | |||
12 | { | 12 | { |
13 | private $constraintName = 'IDX_user_oauth_client'; | 13 | private $constraintName = 'IDX_user_oauth_client'; |
14 | 14 | ||
15 | /** | ||
16 | * @param Schema $schema | ||
17 | */ | ||
18 | public function up(Schema $schema) | 15 | public function up(Schema $schema) |
19 | { | 16 | { |
20 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); | 17 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); |
@@ -32,9 +29,6 @@ class Version20161024212538 extends WallabagMigration | |||
32 | ); | 29 | ); |
33 | } | 30 | } |
34 | 31 | ||
35 | /** | ||
36 | * @param Schema $schema | ||
37 | */ | ||
38 | public function down(Schema $schema) | 32 | public function down(Schema $schema) |
39 | { | 33 | { |
40 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); | 34 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); |
diff --git a/app/DoctrineMigrations/Version20161031132655.php b/app/DoctrineMigrations/Version20161031132655.php index 8d576862..ec58cb2a 100644 --- a/app/DoctrineMigrations/Version20161031132655.php +++ b/app/DoctrineMigrations/Version20161031132655.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161031132655 extends WallabagMigration | 11 | class Version20161031132655 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $images = $this->container | 15 | $images = $this->container |
@@ -25,9 +22,6 @@ class Version20161031132655 extends WallabagMigration | |||
25 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); | 22 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled';"); | 27 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled';"); |
diff --git a/app/DoctrineMigrations/Version20161104073720.php b/app/DoctrineMigrations/Version20161104073720.php index e2b18a46..e0289ec9 100644 --- a/app/DoctrineMigrations/Version20161104073720.php +++ b/app/DoctrineMigrations/Version20161104073720.php | |||
@@ -12,9 +12,6 @@ class Version20161104073720 extends WallabagMigration | |||
12 | { | 12 | { |
13 | private $indexName = 'IDX_entry_created_at'; | 13 | private $indexName = 'IDX_entry_created_at'; |
14 | 14 | ||
15 | /** | ||
16 | * @param Schema $schema | ||
17 | */ | ||
18 | public function up(Schema $schema) | 15 | public function up(Schema $schema) |
19 | { | 16 | { |
20 | $entryTable = $schema->getTable($this->getTable('entry')); | 17 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -23,9 +20,6 @@ class Version20161104073720 extends WallabagMigration | |||
23 | $entryTable->addIndex(['created_at'], $this->indexName); | 20 | $entryTable->addIndex(['created_at'], $this->indexName); |
24 | } | 21 | } |
25 | 22 | ||
26 | /** | ||
27 | * @param Schema $schema | ||
28 | */ | ||
29 | public function down(Schema $schema) | 23 | public function down(Schema $schema) |
30 | { | 24 | { |
31 | $entryTable = $schema->getTable($this->getTable('entry')); | 25 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php index 3a3c90db..5a4831f4 100644 --- a/app/DoctrineMigrations/Version20161106113822.php +++ b/app/DoctrineMigrations/Version20161106113822.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161106113822 extends WallabagMigration | 11 | class Version20161106113822 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $configTable = $schema->getTable($this->getTable('config')); | 15 | $configTable = $schema->getTable($this->getTable('config')); |
@@ -25,9 +22,6 @@ class Version20161106113822 extends WallabagMigration | |||
25 | ]); | 22 | ]); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $configTable = $schema->getTable($this->getTable('config')); | 27 | $configTable = $schema->getTable($this->getTable('config')); |
diff --git a/app/DoctrineMigrations/Version20161117071626.php b/app/DoctrineMigrations/Version20161117071626.php index fc66e7e3..bafb70da 100644 --- a/app/DoctrineMigrations/Version20161117071626.php +++ b/app/DoctrineMigrations/Version20161117071626.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161117071626 extends WallabagMigration | 11 | class Version20161117071626 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $share = $this->container | 15 | $share = $this->container |
@@ -36,9 +33,6 @@ class Version20161117071626 extends WallabagMigration | |||
36 | $this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.'); | 33 | $this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.'); |
37 | } | 34 | } |
38 | 35 | ||
39 | /** | ||
40 | * @param Schema $schema | ||
41 | */ | ||
42 | public function down(Schema $schema) | 36 | public function down(Schema $schema) |
43 | { | 37 | { |
44 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark';"); | 38 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark';"); |
diff --git a/app/DoctrineMigrations/Version20161118134328.php b/app/DoctrineMigrations/Version20161118134328.php index 8302408e..2298447a 100644 --- a/app/DoctrineMigrations/Version20161118134328.php +++ b/app/DoctrineMigrations/Version20161118134328.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161118134328 extends WallabagMigration | 11 | class Version20161118134328 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -25,9 +22,6 @@ class Version20161118134328 extends WallabagMigration | |||
25 | ]); | 22 | ]); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $entryTable = $schema->getTable($this->getTable('entry')); | 27 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20161122144743.php b/app/DoctrineMigrations/Version20161122144743.php index 08a41f48..e628f058 100644 --- a/app/DoctrineMigrations/Version20161122144743.php +++ b/app/DoctrineMigrations/Version20161122144743.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161122144743 extends WallabagMigration | 11 | class Version20161122144743 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $access = $this->container | 15 | $access = $this->container |
@@ -25,9 +22,6 @@ class Version20161122144743 extends WallabagMigration | |||
25 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')"); | 22 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')"); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access';"); | 27 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access';"); |
diff --git a/app/DoctrineMigrations/Version20161122203647.php b/app/DoctrineMigrations/Version20161122203647.php index 60ddeb08..27fe7d2c 100644 --- a/app/DoctrineMigrations/Version20161122203647.php +++ b/app/DoctrineMigrations/Version20161122203647.php | |||
@@ -18,9 +18,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
18 | */ | 18 | */ |
19 | class Version20161122203647 extends WallabagMigration | 19 | class Version20161122203647 extends WallabagMigration |
20 | { | 20 | { |
21 | /** | ||
22 | * @param Schema $schema | ||
23 | */ | ||
24 | public function up(Schema $schema) | 21 | public function up(Schema $schema) |
25 | { | 22 | { |
26 | $userTable = $schema->getTable($this->getTable('user')); | 23 | $userTable = $schema->getTable($this->getTable('user')); |
@@ -31,9 +28,6 @@ class Version20161122203647 extends WallabagMigration | |||
31 | $userTable->dropColumn('credentials_expired'); | 28 | $userTable->dropColumn('credentials_expired'); |
32 | } | 29 | } |
33 | 30 | ||
34 | /** | ||
35 | * @param Schema $schema | ||
36 | */ | ||
37 | public function down(Schema $schema) | 31 | public function down(Schema $schema) |
38 | { | 32 | { |
39 | $userTable = $schema->getTable($this->getTable('user')); | 33 | $userTable = $schema->getTable($this->getTable('user')); |
diff --git a/app/DoctrineMigrations/Version20161128084725.php b/app/DoctrineMigrations/Version20161128084725.php index ef747154..e22e842f 100644 --- a/app/DoctrineMigrations/Version20161128084725.php +++ b/app/DoctrineMigrations/Version20161128084725.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161128084725 extends WallabagMigration | 11 | class Version20161128084725 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $configTable = $schema->getTable($this->getTable('config')); | 15 | $configTable = $schema->getTable($this->getTable('config')); |
@@ -21,9 +18,6 @@ class Version20161128084725 extends WallabagMigration | |||
21 | $configTable->addColumn('list_mode', 'integer', ['notnull' => false]); | 18 | $configTable->addColumn('list_mode', 'integer', ['notnull' => false]); |
22 | } | 19 | } |
23 | 20 | ||
24 | /** | ||
25 | * @param Schema $schema | ||
26 | */ | ||
27 | public function down(Schema $schema) | 21 | public function down(Schema $schema) |
28 | { | 22 | { |
29 | $configTable = $schema->getTable($this->getTable('config')); | 23 | $configTable = $schema->getTable($this->getTable('config')); |
diff --git a/app/DoctrineMigrations/Version20161128131503.php b/app/DoctrineMigrations/Version20161128131503.php index cd434617..2a34d448 100644 --- a/app/DoctrineMigrations/Version20161128131503.php +++ b/app/DoctrineMigrations/Version20161128131503.php | |||
@@ -16,9 +16,6 @@ class Version20161128131503 extends WallabagMigration | |||
16 | 'expires_at' => 'datetime', | 16 | 'expires_at' => 'datetime', |
17 | ]; | 17 | ]; |
18 | 18 | ||
19 | /** | ||
20 | * @param Schema $schema | ||
21 | */ | ||
22 | public function up(Schema $schema) | 19 | public function up(Schema $schema) |
23 | { | 20 | { |
24 | $userTable = $schema->getTable($this->getTable('user')); | 21 | $userTable = $schema->getTable($this->getTable('user')); |
@@ -29,9 +26,6 @@ class Version20161128131503 extends WallabagMigration | |||
29 | } | 26 | } |
30 | } | 27 | } |
31 | 28 | ||
32 | /** | ||
33 | * @param Schema $schema | ||
34 | */ | ||
35 | public function down(Schema $schema) | 29 | public function down(Schema $schema) |
36 | { | 30 | { |
37 | $userTable = $schema->getTable($this->getTable('user')); | 31 | $userTable = $schema->getTable($this->getTable('user')); |
diff --git a/app/DoctrineMigrations/Version20161214094402.php b/app/DoctrineMigrations/Version20161214094402.php index e9f1a302..0240f599 100644 --- a/app/DoctrineMigrations/Version20161214094402.php +++ b/app/DoctrineMigrations/Version20161214094402.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20161214094402 extends WallabagMigration | 11 | class Version20161214094402 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -35,9 +32,6 @@ class Version20161214094402 extends WallabagMigration | |||
35 | } | 32 | } |
36 | } | 33 | } |
37 | 34 | ||
38 | /** | ||
39 | * @param Schema $schema | ||
40 | */ | ||
41 | public function down(Schema $schema) | 35 | public function down(Schema $schema) |
42 | { | 36 | { |
43 | $entryTable = $schema->getTable($this->getTable('entry')); | 37 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20161214094403.php b/app/DoctrineMigrations/Version20161214094403.php index 1f9e1f6b..c6003cb3 100644 --- a/app/DoctrineMigrations/Version20161214094403.php +++ b/app/DoctrineMigrations/Version20161214094403.php | |||
@@ -12,9 +12,6 @@ class Version20161214094403 extends WallabagMigration | |||
12 | { | 12 | { |
13 | private $indexName = 'IDX_entry_uid'; | 13 | private $indexName = 'IDX_entry_uid'; |
14 | 14 | ||
15 | /** | ||
16 | * @param Schema $schema | ||
17 | */ | ||
18 | public function up(Schema $schema) | 15 | public function up(Schema $schema) |
19 | { | 16 | { |
20 | $entryTable = $schema->getTable($this->getTable('entry')); | 17 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -23,9 +20,6 @@ class Version20161214094403 extends WallabagMigration | |||
23 | $entryTable->addIndex(['uid'], $this->indexName); | 20 | $entryTable->addIndex(['uid'], $this->indexName); |
24 | } | 21 | } |
25 | 22 | ||
26 | /** | ||
27 | * @param Schema $schema | ||
28 | */ | ||
29 | public function down(Schema $schema) | 23 | public function down(Schema $schema) |
30 | { | 24 | { |
31 | $entryTable = $schema->getTable($this->getTable('entry')); | 25 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20170127093841.php b/app/DoctrineMigrations/Version20170127093841.php index 491b9383..d8eb34e5 100644 --- a/app/DoctrineMigrations/Version20170127093841.php +++ b/app/DoctrineMigrations/Version20170127093841.php | |||
@@ -13,9 +13,6 @@ class Version20170127093841 extends WallabagMigration | |||
13 | private $indexStarredName = 'IDX_entry_starred'; | 13 | private $indexStarredName = 'IDX_entry_starred'; |
14 | private $indexArchivedName = 'IDX_entry_archived'; | 14 | private $indexArchivedName = 'IDX_entry_archived'; |
15 | 15 | ||
16 | /** | ||
17 | * @param Schema $schema | ||
18 | */ | ||
19 | public function up(Schema $schema) | 16 | public function up(Schema $schema) |
20 | { | 17 | { |
21 | $entryTable = $schema->getTable($this->getTable('entry')); | 18 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -25,9 +22,6 @@ class Version20170127093841 extends WallabagMigration | |||
25 | $entryTable->addIndex(['is_archived'], $this->indexArchivedName); | 22 | $entryTable->addIndex(['is_archived'], $this->indexArchivedName); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $entryTable = $schema->getTable($this->getTable('entry')); | 27 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20170327194233.php b/app/DoctrineMigrations/Version20170327194233.php index 1aa20eb5..268f8cde 100644 --- a/app/DoctrineMigrations/Version20170327194233.php +++ b/app/DoctrineMigrations/Version20170327194233.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170327194233 extends WallabagMigration | 11 | class Version20170327194233 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $scuttle = $this->container | 15 | $scuttle = $this->container |
@@ -26,9 +23,6 @@ class Version20170327194233 extends WallabagMigration | |||
26 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); | 23 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); |
27 | } | 24 | } |
28 | 25 | ||
29 | /** | ||
30 | * @param Schema $schema | ||
31 | */ | ||
32 | public function down(Schema $schema) | 26 | public function down(Schema $schema) |
33 | { | 27 | { |
34 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle';"); | 28 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle';"); |
diff --git a/app/DoctrineMigrations/Version20170405182620.php b/app/DoctrineMigrations/Version20170405182620.php index c7752664..798c72af 100644 --- a/app/DoctrineMigrations/Version20170405182620.php +++ b/app/DoctrineMigrations/Version20170405182620.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170405182620 extends WallabagMigration | 11 | class Version20170405182620 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -30,9 +27,6 @@ class Version20170405182620 extends WallabagMigration | |||
30 | ]); | 27 | ]); |
31 | } | 28 | } |
32 | 29 | ||
33 | /** | ||
34 | * @param Schema $schema | ||
35 | */ | ||
36 | public function down(Schema $schema) | 30 | public function down(Schema $schema) |
37 | { | 31 | { |
38 | $entryTable = $schema->getTable($this->getTable('entry')); | 32 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20170407200919.php b/app/DoctrineMigrations/Version20170407200919.php index ad05eadf..d9fff6c3 100644 --- a/app/DoctrineMigrations/Version20170407200919.php +++ b/app/DoctrineMigrations/Version20170407200919.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170407200919 extends WallabagMigration | 11 | class Version20170407200919 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -21,9 +18,6 @@ class Version20170407200919 extends WallabagMigration | |||
21 | $entryTable->dropColumn('is_public'); | 18 | $entryTable->dropColumn('is_public'); |
22 | } | 19 | } |
23 | 20 | ||
24 | /** | ||
25 | * @param Schema $schema | ||
26 | */ | ||
27 | public function down(Schema $schema) | 21 | public function down(Schema $schema) |
28 | { | 22 | { |
29 | $entryTable = $schema->getTable($this->getTable('entry')); | 23 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20170420134133.php b/app/DoctrineMigrations/Version20170420134133.php index c1732578..2bf05346 100644 --- a/app/DoctrineMigrations/Version20170420134133.php +++ b/app/DoctrineMigrations/Version20170420134133.php | |||
@@ -10,17 +10,11 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170420134133 extends WallabagMigration | 11 | class Version20170420134133 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures';"); | 15 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures';"); |
19 | } | 16 | } |
20 | 17 | ||
21 | /** | ||
22 | * @param Schema $schema | ||
23 | */ | ||
24 | public function down(Schema $schema) | 18 | public function down(Schema $schema) |
25 | { | 19 | { |
26 | $downloadPictures = $this->container | 20 | $downloadPictures = $this->container |
diff --git a/app/DoctrineMigrations/Version20170501115751.php b/app/DoctrineMigrations/Version20170501115751.php index fd238cef..a879cd44 100644 --- a/app/DoctrineMigrations/Version20170501115751.php +++ b/app/DoctrineMigrations/Version20170501115751.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170501115751 extends WallabagMigration | 11 | class Version20170501115751 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $this->skipIf($schema->hasTable($this->getTable('site_credential')), 'It seems that you already played this migration.'); | 15 | $this->skipIf($schema->hasTable($this->getTable('site_credential')), 'It seems that you already played this migration.'); |
@@ -34,9 +31,6 @@ class Version20170501115751 extends WallabagMigration | |||
34 | } | 31 | } |
35 | } | 32 | } |
36 | 33 | ||
37 | /** | ||
38 | * @param Schema $schema | ||
39 | */ | ||
40 | public function down(Schema $schema) | 34 | public function down(Schema $schema) |
41 | { | 35 | { |
42 | $schema->dropTable($this->getTable('site_credential')); | 36 | $schema->dropTable($this->getTable('site_credential')); |
diff --git a/app/DoctrineMigrations/Version20170510082609.php b/app/DoctrineMigrations/Version20170510082609.php index 541ae1fd..ddc894a6 100644 --- a/app/DoctrineMigrations/Version20170510082609.php +++ b/app/DoctrineMigrations/Version20170510082609.php | |||
@@ -17,9 +17,6 @@ class Version20170510082609 extends WallabagMigration | |||
17 | 'email_canonical', | 17 | 'email_canonical', |
18 | ]; | 18 | ]; |
19 | 19 | ||
20 | /** | ||
21 | * @param Schema $schema | ||
22 | */ | ||
23 | public function up(Schema $schema) | 20 | public function up(Schema $schema) |
24 | { | 21 | { |
25 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); | 22 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); |
@@ -29,9 +26,6 @@ class Version20170510082609 extends WallabagMigration | |||
29 | } | 26 | } |
30 | } | 27 | } |
31 | 28 | ||
32 | /** | ||
33 | * @param Schema $schema | ||
34 | */ | ||
35 | public function down(Schema $schema) | 29 | public function down(Schema $schema) |
36 | { | 30 | { |
37 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); | 31 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); |
diff --git a/app/DoctrineMigrations/Version20170511115400.php b/app/DoctrineMigrations/Version20170511115400.php index cb80dd45..9a89cfb8 100644 --- a/app/DoctrineMigrations/Version20170511115400.php +++ b/app/DoctrineMigrations/Version20170511115400.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170511115400 extends WallabagMigration | 11 | class Version20170511115400 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -24,9 +21,6 @@ class Version20170511115400 extends WallabagMigration | |||
24 | ]); | 21 | ]); |
25 | } | 22 | } |
26 | 23 | ||
27 | /** | ||
28 | * @param Schema $schema | ||
29 | */ | ||
30 | public function down(Schema $schema) | 24 | public function down(Schema $schema) |
31 | { | 25 | { |
32 | $entryTable = $schema->getTable($this->getTable('entry')); | 26 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20170511211659.php b/app/DoctrineMigrations/Version20170511211659.php index 00ce7b1f..d0752baf 100644 --- a/app/DoctrineMigrations/Version20170511211659.php +++ b/app/DoctrineMigrations/Version20170511211659.php | |||
@@ -13,19 +13,21 @@ class Version20170511211659 extends WallabagMigration | |||
13 | { | 13 | { |
14 | public function up(Schema $schema) | 14 | public function up(Schema $schema) |
15 | { | 15 | { |
16 | $tableName = $this->getTable('annotation'); | ||
17 | |||
18 | switch ($this->connection->getDatabasePlatform()->getName()) { | 16 | switch ($this->connection->getDatabasePlatform()->getName()) { |
19 | case 'sqlite': | 17 | case 'sqlite': |
18 | $annotationTableName = $this->getTable('annotation', true); | ||
19 | $userTableName = $this->getTable('user', true); | ||
20 | $entryTableName = $this->getTable('entry', true); | ||
21 | |||
20 | $this->addSql(<<<EOD | 22 | $this->addSql(<<<EOD |
21 | CREATE TEMPORARY TABLE __temp__wallabag_annotation AS | 23 | CREATE TEMPORARY TABLE __temp__wallabag_annotation AS |
22 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges | 24 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges |
23 | FROM ${tableName} | 25 | FROM ${annotationTableName} |
24 | EOD | 26 | EOD |
25 | ); | 27 | ); |
26 | $this->addSql('DROP TABLE ' . $tableName); | 28 | $this->addSql('DROP TABLE ' . $annotationTableName); |
27 | $this->addSql(<<<EOD | 29 | $this->addSql(<<<EOD |
28 | CREATE TABLE ${tableName} | 30 | CREATE TABLE ${annotationTableName} |
29 | ( | 31 | ( |
30 | id INTEGER PRIMARY KEY NOT NULL, | 32 | id INTEGER PRIMARY KEY NOT NULL, |
31 | user_id INTEGER DEFAULT NULL, | 33 | user_id INTEGER DEFAULT NULL, |
@@ -35,16 +37,16 @@ CREATE TABLE ${tableName} | |||
35 | updated_at DATETIME NOT NULL, | 37 | updated_at DATETIME NOT NULL, |
36 | quote CLOB NOT NULL, | 38 | quote CLOB NOT NULL, |
37 | ranges CLOB NOT NULL, | 39 | ranges CLOB NOT NULL, |
38 | CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES wallabag_user (id), | 40 | CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES ${userTableName} (id), |
39 | CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES wallabag_entry (id) ON DELETE CASCADE | 41 | CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES ${entryTableName} (id) ON DELETE CASCADE |
40 | ); | 42 | ); |
41 | CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id); | 43 | CREATE INDEX IDX_A7AED006A76ED395 ON ${annotationTableName} (user_id); |
42 | CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id); | 44 | CREATE INDEX IDX_A7AED006BA364942 ON ${annotationTableName} (entry_id); |
43 | EOD | 45 | EOD |
44 | ); | 46 | ); |
45 | 47 | ||
46 | $this->addSql(<<<EOD | 48 | $this->addSql(<<<EOD |
47 | INSERT INTO ${tableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges) | 49 | INSERT INTO ${annotationTableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges) |
48 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges | 50 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges |
49 | FROM __temp__wallabag_annotation; | 51 | FROM __temp__wallabag_annotation; |
50 | EOD | 52 | EOD |
@@ -52,10 +54,10 @@ EOD | |||
52 | $this->addSql('DROP TABLE __temp__wallabag_annotation'); | 54 | $this->addSql('DROP TABLE __temp__wallabag_annotation'); |
53 | break; | 55 | break; |
54 | case 'mysql': | 56 | case 'mysql': |
55 | $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote TEXT NOT NULL'); | 57 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' MODIFY quote TEXT NOT NULL'); |
56 | break; | 58 | break; |
57 | case 'postgresql': | 59 | case 'postgresql': |
58 | $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE TEXT'); | 60 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ALTER COLUMN quote TYPE TEXT'); |
59 | break; | 61 | break; |
60 | } | 62 | } |
61 | } | 63 | } |
diff --git a/app/DoctrineMigrations/Version20170602075214.php b/app/DoctrineMigrations/Version20170602075214.php index 12997c71..f72839b2 100644 --- a/app/DoctrineMigrations/Version20170602075214.php +++ b/app/DoctrineMigrations/Version20170602075214.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170602075214 extends WallabagMigration | 11 | class Version20170602075214 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $apiUserRegistration = $this->container | 15 | $apiUserRegistration = $this->container |
@@ -25,9 +22,6 @@ class Version20170602075214 extends WallabagMigration | |||
25 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')"); | 22 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')"); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration';"); | 27 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration';"); |
diff --git a/app/DoctrineMigrations/Version20170606155640.php b/app/DoctrineMigrations/Version20170606155640.php index 153d31b8..099e5329 100644 --- a/app/DoctrineMigrations/Version20170606155640.php +++ b/app/DoctrineMigrations/Version20170606155640.php | |||
@@ -11,9 +11,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
11 | */ | 11 | */ |
12 | class Version20170606155640 extends WallabagMigration | 12 | class Version20170606155640 extends WallabagMigration |
13 | { | 13 | { |
14 | /** | ||
15 | * @param Schema $schema | ||
16 | */ | ||
17 | public function up(Schema $schema) | 14 | public function up(Schema $schema) |
18 | { | 15 | { |
19 | $apiUserRegistration = $this->container | 16 | $apiUserRegistration = $this->container |
@@ -26,9 +23,6 @@ class Version20170606155640 extends WallabagMigration | |||
26 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'"); | 23 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'"); |
27 | } | 24 | } |
28 | 25 | ||
29 | /** | ||
30 | * @param Schema $schema | ||
31 | */ | ||
32 | public function down(Schema $schema) | 26 | public function down(Schema $schema) |
33 | { | 27 | { |
34 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')"); | 28 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')"); |
diff --git a/app/DoctrineMigrations/Version20170719231144.php b/app/DoctrineMigrations/Version20170719231144.php index 93fe7f26..7a9731d4 100644 --- a/app/DoctrineMigrations/Version20170719231144.php +++ b/app/DoctrineMigrations/Version20170719231144.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170719231144 extends WallabagMigration | 11 | class Version20170719231144 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); | 15 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); |
@@ -89,9 +86,6 @@ class Version20170719231144 extends WallabagMigration | |||
89 | ); | 86 | ); |
90 | } | 87 | } |
91 | 88 | ||
92 | /** | ||
93 | * @param Schema $schema | ||
94 | */ | ||
95 | public function down(Schema $schema) | 89 | public function down(Schema $schema) |
96 | { | 90 | { |
97 | throw new SkipMigrationException('Too complex ...'); | 91 | throw new SkipMigrationException('Too complex ...'); |
diff --git a/app/DoctrineMigrations/Version20170824113337.php b/app/DoctrineMigrations/Version20170824113337.php index 5fc31de9..dc20f6d9 100644 --- a/app/DoctrineMigrations/Version20170824113337.php +++ b/app/DoctrineMigrations/Version20170824113337.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20170824113337 extends WallabagMigration | 11 | class Version20170824113337 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -37,9 +34,6 @@ class Version20170824113337 extends WallabagMigration | |||
37 | ); | 34 | ); |
38 | } | 35 | } |
39 | 36 | ||
40 | /** | ||
41 | * @param Schema $schema | ||
42 | */ | ||
43 | public function down(Schema $schema) | 37 | public function down(Schema $schema) |
44 | { | 38 | { |
45 | $entryTable = $schema->getTable($this->getTable('entry')); | 39 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20171008195606.php b/app/DoctrineMigrations/Version20171008195606.php index 6974232a..60d8777f 100644 --- a/app/DoctrineMigrations/Version20171008195606.php +++ b/app/DoctrineMigrations/Version20171008195606.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20171008195606 extends WallabagMigration | 11 | class Version20171008195606 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); | 15 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); |
@@ -29,9 +26,6 @@ class Version20171008195606 extends WallabagMigration | |||
29 | } | 26 | } |
30 | } | 27 | } |
31 | 28 | ||
32 | /** | ||
33 | * @param Schema $schema | ||
34 | */ | ||
35 | public function down(Schema $schema) | 29 | public function down(Schema $schema) |
36 | { | 30 | { |
37 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); | 31 | $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); |
diff --git a/app/DoctrineMigrations/Version20171105202000.php b/app/DoctrineMigrations/Version20171105202000.php index 5ed787b9..5313a336 100644 --- a/app/DoctrineMigrations/Version20171105202000.php +++ b/app/DoctrineMigrations/Version20171105202000.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20171105202000 extends WallabagMigration | 11 | class Version20171105202000 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $entryTable = $schema->getTable($this->getTable('entry')); | 15 | $entryTable = $schema->getTable($this->getTable('entry')); |
@@ -24,9 +21,6 @@ class Version20171105202000 extends WallabagMigration | |||
24 | ]); | 21 | ]); |
25 | } | 22 | } |
26 | 23 | ||
27 | /** | ||
28 | * @param Schema $schema | ||
29 | */ | ||
30 | public function down(Schema $schema) | 24 | public function down(Schema $schema) |
31 | { | 25 | { |
32 | $entryTable = $schema->getTable($this->getTable('entry')); | 26 | $entryTable = $schema->getTable($this->getTable('entry')); |
diff --git a/app/DoctrineMigrations/Version20171120163128.php b/app/DoctrineMigrations/Version20171120163128.php index 48f10f1d..a6d126a5 100644 --- a/app/DoctrineMigrations/Version20171120163128.php +++ b/app/DoctrineMigrations/Version20171120163128.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20171120163128 extends WallabagMigration | 11 | class Version20171120163128 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $storeArticleHeaders = $this->container | 15 | $storeArticleHeaders = $this->container |
@@ -25,9 +22,6 @@ class Version20171120163128 extends WallabagMigration | |||
25 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('store_article_headers', '0', 'entry')"); | 22 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('store_article_headers', '0', 'entry')"); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers';"); | 27 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers';"); |
diff --git a/app/DoctrineMigrations/Version20171125164500.php b/app/DoctrineMigrations/Version20171125164500.php index a72463f0..2ee49d87 100644 --- a/app/DoctrineMigrations/Version20171125164500.php +++ b/app/DoctrineMigrations/Version20171125164500.php | |||
@@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; | |||
10 | */ | 10 | */ |
11 | class Version20171125164500 extends WallabagMigration | 11 | class Version20171125164500 extends WallabagMigration |
12 | { | 12 | { |
13 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | 13 | public function up(Schema $schema) |
17 | { | 14 | { |
18 | $shaarliShareOriginUrl = $this->container | 15 | $shaarliShareOriginUrl = $this->container |
@@ -25,9 +22,6 @@ class Version20171125164500 extends WallabagMigration | |||
25 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('shaarli_share_origin_url', '0', 'entry')"); | 22 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('shaarli_share_origin_url', '0', 'entry')"); |
26 | } | 23 | } |
27 | 24 | ||
28 | /** | ||
29 | * @param Schema $schema | ||
30 | */ | ||
31 | public function down(Schema $schema) | 25 | public function down(Schema $schema) |
32 | { | 26 | { |
33 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'shaarli_share_origin_url';"); | 27 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'shaarli_share_origin_url';"); |
diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php new file mode 100755 index 00000000..1b8c3b0e --- /dev/null +++ b/app/DoctrineMigrations/Version20180405182455.php | |||
@@ -0,0 +1,45 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Add archived_at column and set its value to updated_at for is_archived entries. | ||
10 | */ | ||
11 | class Version20180405182455 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema) | ||
14 | { | ||
15 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
16 | |||
17 | $this->skipIf($entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.'); | ||
18 | |||
19 | $entryTable->addColumn('archived_at', 'datetime', [ | ||
20 | 'notnull' => false, | ||
21 | ]); | ||
22 | } | ||
23 | |||
24 | public function postUp(Schema $schema) | ||
25 | { | ||
26 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
27 | $this->skipIf(!$entryTable->hasColumn('archived_at'), 'Unable to add archived_at colum'); | ||
28 | |||
29 | $this->connection->executeQuery( | ||
30 | 'UPDATE ' . $this->getTable('entry') . ' SET archived_at = updated_at WHERE is_archived = :is_archived', | ||
31 | [ | ||
32 | 'is_archived' => true, | ||
33 | ] | ||
34 | ); | ||
35 | } | ||
36 | |||
37 | public function down(Schema $schema) | ||
38 | { | ||
39 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
40 | |||
41 | $this->skipIf(!$entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.'); | ||
42 | |||
43 | $entryTable->dropColumn('archived_at'); | ||
44 | } | ||
45 | } | ||
diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php new file mode 100644 index 00000000..add161cd --- /dev/null +++ b/app/DoctrineMigrations/Version20181128203230.php | |||
@@ -0,0 +1,42 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Fix varchar field from vendor to work with utf8mb4. | ||
10 | */ | ||
11 | class Version20181128203230 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema) | ||
14 | { | ||
15 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); | ||
16 | |||
17 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); | ||
18 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)'); | ||
19 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL'); | ||
20 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)'); | ||
21 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); | ||
22 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)'); | ||
23 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)'); | ||
24 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)'); | ||
25 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)'); | ||
26 | } | ||
27 | |||
28 | public function down(Schema $schema) | ||
29 | { | ||
30 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); | ||
31 | |||
32 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); | ||
33 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)'); | ||
34 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL'); | ||
35 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)'); | ||
36 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); | ||
37 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)'); | ||
38 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)'); | ||
39 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)'); | ||
40 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)'); | ||
41 | } | ||
42 | } | ||
diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php new file mode 100644 index 00000000..5978291e --- /dev/null +++ b/app/DoctrineMigrations/Version20181202073750.php | |||
@@ -0,0 +1,76 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Add 2fa OTP stuff. | ||
10 | */ | ||
11 | final class Version20181202073750 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema): void | ||
14 | { | ||
15 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
16 | case 'sqlite': | ||
17 | $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297'); | ||
18 | $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF'); | ||
19 | $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8'); | ||
20 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM ' . $this->getTable('user', true) . ''); | ||
21 | $this->addSql('DROP TABLE ' . $this->getTable('user', true) . ''); | ||
22 | $this->addSql('CREATE TABLE ' . $this->getTable('user', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL COLLATE BINARY, username_canonical VARCHAR(180) NOT NULL COLLATE BINARY, email VARCHAR(180) NOT NULL COLLATE BINARY, email_canonical VARCHAR(180) NOT NULL COLLATE BINARY, enabled BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL COLLATE BINARY, last_login DATETIME DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, emailTwoFactor BOOLEAN NOT NULL, salt VARCHAR(255) DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, roles CLOB NOT NULL --(DC2Type:array) | ||
23 | , googleAuthenticatorSecret VARCHAR(255) DEFAULT NULL, backupCodes CLOB DEFAULT NULL --(DC2Type:json_array) | ||
24 | )'); | ||
25 | $this->addSql('INSERT INTO ' . $this->getTable('user', true) . ' (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM __temp__' . $this->getTable('user', true) . ''); | ||
26 | $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . ''); | ||
27 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON ' . $this->getTable('user', true) . ' (confirmation_token)'); | ||
28 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON ' . $this->getTable('user', true) . ' (email_canonical)'); | ||
29 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON ' . $this->getTable('user', true) . ' (username_canonical)'); | ||
30 | break; | ||
31 | case 'mysql': | ||
32 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL'); | ||
33 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL'); | ||
34 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted'); | ||
35 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\''); | ||
36 | break; | ||
37 | case 'postgresql': | ||
38 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL'); | ||
39 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN twofactorauthentication TO emailTwoFactor'); | ||
40 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted'); | ||
41 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes TEXT DEFAULT NULL'); | ||
42 | break; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public function down(Schema $schema): void | ||
47 | { | ||
48 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
49 | case 'sqlite': | ||
50 | $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8'); | ||
51 | $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF'); | ||
52 | $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297'); | ||
53 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM "' . $this->getTable('user', true) . '"'); | ||
54 | $this->addSql('DROP TABLE "' . $this->getTable('user', true) . '"'); | ||
55 | $this->addSql('CREATE TABLE "' . $this->getTable('user', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL COLLATE BINARY, confirmation_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, roles CLOB NOT NULL COLLATE BINARY, trusted CLOB DEFAULT NULL COLLATE BINARY)'); | ||
56 | $this->addSql('INSERT INTO "' . $this->getTable('user', true) . '" (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM __temp__' . $this->getTable('user', true) . ''); | ||
57 | $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . ''); | ||
58 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "' . $this->getTable('user', true) . '" (username_canonical)'); | ||
59 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "' . $this->getTable('user', true) . '" (email_canonical)'); | ||
60 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "' . $this->getTable('user', true) . '" (confirmation_token)'); | ||
61 | break; | ||
62 | case 'mysql': | ||
63 | $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret'); | ||
64 | $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL'); | ||
65 | $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` ADD trusted TEXT DEFAULT NULL'); | ||
66 | $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP backupCodes'); | ||
67 | break; | ||
68 | case 'postgresql': | ||
69 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP googleAuthenticatorSecret'); | ||
70 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN emailTwoFactor TO twofactorauthentication'); | ||
71 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD trusted TEXT DEFAULT NULL'); | ||
72 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP backupCodes'); | ||
73 | break; | ||
74 | } | ||
75 | } | ||
76 | } | ||
diff --git a/app/DoctrineMigrations/Version20190117131816.php b/app/DoctrineMigrations/Version20190117131816.php new file mode 100644 index 00000000..6548b9fa --- /dev/null +++ b/app/DoctrineMigrations/Version20190117131816.php | |||
@@ -0,0 +1,32 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Add updated_at fields to site_credential table. | ||
10 | */ | ||
11 | final class Version20190117131816 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema): void | ||
14 | { | ||
15 | $siteCredentialTable = $schema->getTable($this->getTable('site_credential')); | ||
16 | |||
17 | $this->skipIf($siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.'); | ||
18 | |||
19 | $siteCredentialTable->addColumn('updated_at', 'datetime', [ | ||
20 | 'notnull' => false, | ||
21 | ]); | ||
22 | } | ||
23 | |||
24 | public function down(Schema $schema): void | ||
25 | { | ||
26 | $siteCredentialTable = $schema->getTable($this->getTable('site_credential')); | ||
27 | |||
28 | $this->skipIf(!$siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.'); | ||
29 | |||
30 | $siteCredentialTable->dropColumn('updated_at'); | ||
31 | } | ||
32 | } | ||
diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php new file mode 100644 index 00000000..8c5e28ca --- /dev/null +++ b/app/DoctrineMigrations/Version20190129120000.php | |||
@@ -0,0 +1,141 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Add missing entries in craue_config_setting. | ||
10 | */ | ||
11 | final class Version20190129120000 extends WallabagMigration | ||
12 | { | ||
13 | private $settings = [ | ||
14 | [ | ||
15 | 'name' => 'carrot', | ||
16 | 'value' => '1', | ||
17 | 'section' => 'entry', | ||
18 | ], | ||
19 | [ | ||
20 | 'name' => 'share_diaspora', | ||
21 | 'value' => '1', | ||
22 | 'section' => 'entry', | ||
23 | ], | ||
24 | [ | ||
25 | 'name' => 'diaspora_url', | ||
26 | 'value' => 'http://diasporapod.com', | ||
27 | 'section' => 'entry', | ||
28 | ], | ||
29 | [ | ||
30 | 'name' => 'share_shaarli', | ||
31 | 'value' => '1', | ||
32 | 'section' => 'entry', | ||
33 | ], | ||
34 | [ | ||
35 | 'name' => 'shaarli_url', | ||
36 | 'value' => 'http://myshaarli.com', | ||
37 | 'section' => 'entry', | ||
38 | ], | ||
39 | [ | ||
40 | 'name' => 'share_mail', | ||
41 | 'value' => '1', | ||
42 | 'section' => 'entry', | ||
43 | ], | ||
44 | [ | ||
45 | 'name' => 'share_twitter', | ||
46 | 'value' => '1', | ||
47 | 'section' => 'entry', | ||
48 | ], | ||
49 | [ | ||
50 | 'name' => 'show_printlink', | ||
51 | 'value' => '1', | ||
52 | 'section' => 'entry', | ||
53 | ], | ||
54 | [ | ||
55 | 'name' => 'export_epub', | ||
56 | 'value' => '1', | ||
57 | 'section' => 'export', | ||
58 | ], | ||
59 | [ | ||
60 | 'name' => 'export_mobi', | ||
61 | 'value' => '1', | ||
62 | 'section' => 'export', | ||
63 | ], | ||
64 | [ | ||
65 | 'name' => 'export_pdf', | ||
66 | 'value' => '1', | ||
67 | 'section' => 'export', | ||
68 | ], | ||
69 | [ | ||
70 | 'name' => 'export_csv', | ||
71 | 'value' => '1', | ||
72 | 'section' => 'export', | ||
73 | ], | ||
74 | [ | ||
75 | 'name' => 'export_json', | ||
76 | 'value' => '1', | ||
77 | 'section' => 'export', | ||
78 | ], | ||
79 | [ | ||
80 | 'name' => 'export_txt', | ||
81 | 'value' => '1', | ||
82 | 'section' => 'export', | ||
83 | ], | ||
84 | [ | ||
85 | 'name' => 'export_xml', | ||
86 | 'value' => '1', | ||
87 | 'section' => 'export', | ||
88 | ], | ||
89 | [ | ||
90 | 'name' => 'piwik_enabled', | ||
91 | 'value' => '0', | ||
92 | 'section' => 'analytics', | ||
93 | ], | ||
94 | [ | ||
95 | 'name' => 'piwik_host', | ||
96 | 'value' => 'v2.wallabag.org', | ||
97 | 'section' => 'analytics', | ||
98 | ], | ||
99 | [ | ||
100 | 'name' => 'piwik_site_id', | ||
101 | 'value' => '1', | ||
102 | 'section' => 'analytics', | ||
103 | ], | ||
104 | [ | ||
105 | 'name' => 'demo_mode_enabled', | ||
106 | 'value' => '0', | ||
107 | 'section' => 'misc', | ||
108 | ], | ||
109 | [ | ||
110 | 'name' => 'demo_mode_username', | ||
111 | 'value' => 'wallabag', | ||
112 | 'section' => 'misc', | ||
113 | ], | ||
114 | [ | ||
115 | 'name' => 'wallabag_support_url', | ||
116 | 'value' => 'https://www.wallabag.org/pages/support.html', | ||
117 | 'section' => 'misc', | ||
118 | ], | ||
119 | ]; | ||
120 | |||
121 | public function up(Schema $schema) | ||
122 | { | ||
123 | foreach ($this->settings as $setting) { | ||
124 | $settingEnabled = $this->container | ||
125 | ->get('doctrine.orm.default_entity_manager') | ||
126 | ->getConnection() | ||
127 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'"); | ||
128 | |||
129 | if (false !== $settingEnabled) { | ||
130 | continue; | ||
131 | } | ||
132 | |||
133 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');"); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | public function down(Schema $schema) | ||
138 | { | ||
139 | $this->skipIf(true, 'These settings are required and should not be removed.'); | ||
140 | } | ||
141 | } | ||
diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php new file mode 100644 index 00000000..600fc162 --- /dev/null +++ b/app/DoctrineMigrations/Version20190401105353.php | |||
@@ -0,0 +1,36 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Add hashed_url in entry. | ||
10 | */ | ||
11 | class Version20190401105353 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema) | ||
14 | { | ||
15 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
16 | |||
17 | $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); | ||
18 | |||
19 | $entryTable->addColumn('hashed_url', 'text', [ | ||
20 | 'length' => 40, | ||
21 | 'notnull' => false, | ||
22 | ]); | ||
23 | |||
24 | $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); | ||
25 | } | ||
26 | |||
27 | public function down(Schema $schema) | ||
28 | { | ||
29 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
30 | |||
31 | $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); | ||
32 | |||
33 | $entryTable->dropIndex('hashed_url_user_id'); | ||
34 | $entryTable->dropColumn('hashed_url'); | ||
35 | } | ||
36 | } | ||
diff --git a/app/DoctrineMigrations/Version20190425115043.php b/app/DoctrineMigrations/Version20190425115043.php new file mode 100644 index 00000000..5c6ae494 --- /dev/null +++ b/app/DoctrineMigrations/Version20190425115043.php | |||
@@ -0,0 +1,58 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Rename rss_token & rss_limit to feed_token & feed_limit. | ||
10 | */ | ||
11 | final class Version20190425115043 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema): void | ||
14 | { | ||
15 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
16 | case 'sqlite': | ||
17 | $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); | ||
18 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM ' . $this->getTable('config', true)); | ||
19 | $this->addSql('DROP TABLE ' . $this->getTable('config', true)); | ||
20 | $this->addSql('CREATE TABLE ' . $this->getTable('config', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL COLLATE BINARY, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL COLLATE BINARY, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL COLLATE BINARY, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, feed_token VARCHAR(255) DEFAULT NULL, feed_limit INTEGER DEFAULT NULL, CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('user', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
21 | $this->addSql('INSERT INTO ' . $this->getTable('config', true) . ' (id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true)); | ||
22 | $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); | ||
23 | $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)'); | ||
24 | break; | ||
25 | case 'mysql': | ||
26 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_token feed_token VARCHAR(255) DEFAULT NULL'); | ||
27 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_limit feed_limit INT DEFAULT NULL'); | ||
28 | break; | ||
29 | case 'postgresql': | ||
30 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_token TO feed_token'); | ||
31 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_limit TO feed_limit'); | ||
32 | break; | ||
33 | } | ||
34 | } | ||
35 | |||
36 | public function down(Schema $schema): void | ||
37 | { | ||
38 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
39 | case 'sqlite': | ||
40 | $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); | ||
41 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM "' . $this->getTable('config', true) . '"'); | ||
42 | $this->addSql('DROP TABLE "' . $this->getTable('config', true) . '"'); | ||
43 | $this->addSql('CREATE TABLE "' . $this->getTable('config', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, rss_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, rss_limit INTEGER DEFAULT NULL)'); | ||
44 | $this->addSql('INSERT INTO "' . $this->getTable('config', true) . '" (id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true)); | ||
45 | $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); | ||
46 | $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "' . $this->getTable('config', true) . '" (user_id)'); | ||
47 | break; | ||
48 | case 'mysql': | ||
49 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_token rss_token'); | ||
50 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_limit rss_limit'); | ||
51 | break; | ||
52 | case 'postgresql': | ||
53 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_token TO rss_token'); | ||
54 | $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_limit TO rss_limit'); | ||
55 | break; | ||
56 | } | ||
57 | } | ||
58 | } | ||
diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php new file mode 100644 index 00000000..3c504e8a --- /dev/null +++ b/app/DoctrineMigrations/Version20190510141130.php | |||
@@ -0,0 +1,96 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\SkipMigrationException; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
8 | |||
9 | /** | ||
10 | * Enable cascade delete when deleting a user on: | ||
11 | * - oauth2_access_tokens | ||
12 | * - oauth2_clients | ||
13 | * - oauth2_refresh_tokens | ||
14 | * - oauth2_auth_codes. | ||
15 | */ | ||
16 | final class Version20190510141130 extends WallabagMigration | ||
17 | { | ||
18 | public function up(Schema $schema): void | ||
19 | { | ||
20 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
21 | case 'sqlite': | ||
22 | $this->addSql('DROP INDEX IDX_368A4209A76ED395'); | ||
23 | $this->addSql('DROP INDEX IDX_368A420919EB6921'); | ||
24 | $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); | ||
25 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_access_tokens', true)); | ||
26 | $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true)); | ||
27 | $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_access_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
28 | $this->addSql('INSERT INTO ' . $this->getTable('oauth2_access_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_access_tokens', true)); | ||
29 | $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true)); | ||
30 | $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); | ||
31 | $this->addSql('CREATE INDEX IDX_368A420919EB6921 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (client_id)'); | ||
32 | |||
33 | $this->addSql('DROP INDEX IDX_635D765EA76ED395'); | ||
34 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_clients', true) . ' AS SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM ' . $this->getTable('oauth2_clients', true)); | ||
35 | $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true)); | ||
36 | $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_clients', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, name CLOB NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL, allowed_grant_types CLOB NOT NULL, CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
37 | $this->addSql('INSERT INTO ' . $this->getTable('oauth2_clients', true) . ' (id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name) SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM __temp__' . $this->getTable('oauth2_clients', true)); | ||
38 | $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true)); | ||
39 | $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)'); | ||
40 | |||
41 | $this->addSql('DROP INDEX IDX_20C9FB24A76ED395'); | ||
42 | $this->addSql('DROP INDEX IDX_20C9FB2419EB6921'); | ||
43 | $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); | ||
44 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_refresh_tokens', true)); | ||
45 | $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true)); | ||
46 | $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
47 | $this->addSql('INSERT INTO ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_refresh_tokens', true)); | ||
48 | $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true)); | ||
49 | $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); | ||
50 | $this->addSql('CREATE INDEX IDX_20C9FB2419EB6921 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (client_id)'); | ||
51 | |||
52 | $this->addSql('DROP INDEX IDX_EE52E3FAA76ED395'); | ||
53 | $this->addSql('DROP INDEX IDX_EE52E3FA19EB6921'); | ||
54 | $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); | ||
55 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ' AS SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM ' . $this->getTable('oauth2_auth_codes', true)); | ||
56 | $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true)); | ||
57 | $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_auth_codes', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, redirect_uri CLOB NOT NULL COLLATE BINARY, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
58 | $this->addSql('INSERT INTO ' . $this->getTable('oauth2_auth_codes', true) . ' (id, client_id, user_id, token, redirect_uri, expires_at, scope) SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM __temp__' . $this->getTable('oauth2_auth_codes', true)); | ||
59 | $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true)); | ||
60 | $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); | ||
61 | $this->addSql('CREATE INDEX IDX_EE52E3FA19EB6921 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (client_id)'); | ||
62 | break; | ||
63 | case 'mysql': | ||
64 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP FOREIGN KEY FK_368A4209A76ED395'); | ||
65 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE'); | ||
66 | |||
67 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP FOREIGN KEY IDX_user_oauth_client'); | ||
68 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id)'); | ||
69 | |||
70 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP FOREIGN KEY FK_20C9FB24A76ED395'); | ||
71 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE'); | ||
72 | |||
73 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP FOREIGN KEY FK_EE52E3FAA76ED395'); | ||
74 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE'); | ||
75 | break; | ||
76 | case 'postgresql': | ||
77 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP CONSTRAINT FK_368A4209A76ED395'); | ||
78 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
79 | |||
80 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP CONSTRAINT idx_user_oauth_client'); | ||
81 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
82 | |||
83 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP CONSTRAINT FK_20C9FB24A76ED395'); | ||
84 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
85 | |||
86 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP CONSTRAINT FK_EE52E3FAA76ED395'); | ||
87 | $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
88 | break; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | public function down(Schema $schema): void | ||
93 | { | ||
94 | throw new SkipMigrationException('Too complex ...'); | ||
95 | } | ||
96 | } | ||
diff --git a/app/DoctrineMigrations/Version20190511165128.php b/app/DoctrineMigrations/Version20190511165128.php new file mode 100644 index 00000000..7b6b1bec --- /dev/null +++ b/app/DoctrineMigrations/Version20190511165128.php | |||
@@ -0,0 +1,30 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Application\Migrations; | ||
6 | |||
7 | use Doctrine\DBAL\Schema\Schema; | ||
8 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
9 | |||
10 | /** | ||
11 | * Convert tab label to utf8mb4_bin (MySQL only). | ||
12 | */ | ||
13 | final class Version20190511165128 extends WallabagMigration | ||
14 | { | ||
15 | public function up(Schema $schema): void | ||
16 | { | ||
17 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); | ||
18 | |||
19 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;'); | ||
20 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;'); | ||
21 | } | ||
22 | |||
23 | public function down(Schema $schema): void | ||
24 | { | ||
25 | $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); | ||
26 | |||
27 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
28 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
29 | } | ||
30 | } | ||
diff --git a/app/DoctrineMigrations/Version20190601125843.php b/app/DoctrineMigrations/Version20190601125843.php new file mode 100644 index 00000000..cbb92edc --- /dev/null +++ b/app/DoctrineMigrations/Version20190601125843.php | |||
@@ -0,0 +1,48 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Added `given_url` & `hashed_given_url` field in entry table. | ||
10 | */ | ||
11 | class Version20190601125843 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema) | ||
14 | { | ||
15 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
16 | |||
17 | if (!$entryTable->hasColumn('given_url')) { | ||
18 | $entryTable->addColumn('given_url', 'text', [ | ||
19 | 'notnull' => false, | ||
20 | ]); | ||
21 | } | ||
22 | |||
23 | if (!$entryTable->hasColumn('hashed_given_url')) { | ||
24 | $entryTable->addColumn('hashed_given_url', 'text', [ | ||
25 | 'length' => 40, | ||
26 | 'notnull' => false, | ||
27 | ]); | ||
28 | } | ||
29 | |||
30 | // 40 = length of sha1 field hashed_given_url | ||
31 | $entryTable->addIndex(['user_id', 'hashed_given_url'], 'hashed_given_url_user_id', [], ['lengths' => [null, 40]]); | ||
32 | } | ||
33 | |||
34 | public function down(Schema $schema) | ||
35 | { | ||
36 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
37 | |||
38 | if ($entryTable->hasColumn('given_url')) { | ||
39 | $entryTable->dropColumn('given_url'); | ||
40 | } | ||
41 | |||
42 | if ($entryTable->hasColumn('hashed_given_url')) { | ||
43 | $entryTable->dropColumn('hashed_given_url'); | ||
44 | } | ||
45 | |||
46 | $entryTable->dropIndex('hashed_given_url_user_id'); | ||
47 | } | ||
48 | } | ||
diff --git a/app/DoctrineMigrations/Version20190619093534.php b/app/DoctrineMigrations/Version20190619093534.php new file mode 100644 index 00000000..9a062536 --- /dev/null +++ b/app/DoctrineMigrations/Version20190619093534.php | |||
@@ -0,0 +1,65 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Change reading_time field on SQLite to be integer NOT NULL | ||
10 | * It was forgotten in a previous migration (Version20171008195606.php). | ||
11 | */ | ||
12 | final class Version20190619093534 extends WallabagMigration | ||
13 | { | ||
14 | public function up(Schema $schema): void | ||
15 | { | ||
16 | // this up() migration is auto-generated, please modify it to your needs | ||
17 | $this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); | ||
18 | |||
19 | $this->addSql('UPDATE ' . $this->getTable('entry', true) . ' SET reading_time = 0 WHERE reading_time IS NULL;'); | ||
20 | |||
21 | $this->addSql('DROP INDEX hashed_given_url_user_id'); | ||
22 | $this->addSql('DROP INDEX IDX_entry_uid'); | ||
23 | $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); | ||
24 | $this->addSql('DROP INDEX IDX_entry_created_at'); | ||
25 | $this->addSql('DROP INDEX IDX_entry_starred'); | ||
26 | $this->addSql('DROP INDEX IDX_entry_archived'); | ||
27 | $this->addSql('DROP INDEX hashed_url_user_id'); | ||
28 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('entry', true) . ' AS SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM ' . $this->getTable('entry', true) . ''); | ||
29 | $this->addSql('DROP TABLE ' . $this->getTable('entry', true) . ''); | ||
30 | $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) | ||
31 | , headers CLOB DEFAULT NULL --(DC2Type:array) | ||
32 | , hashed_url VARCHAR(40) DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('user', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
33 | $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM __temp__' . $this->getTable('entry', true) . ''); | ||
34 | $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); | ||
35 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); | ||
36 | $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); | ||
37 | $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); | ||
38 | $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); | ||
39 | $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); | ||
40 | } | ||
41 | |||
42 | public function down(Schema $schema): void | ||
43 | { | ||
44 | // this down() migration is auto-generated, please modify it to your needs | ||
45 | $this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); | ||
46 | |||
47 | $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); | ||
48 | $this->addSql('DROP INDEX created_at'); | ||
49 | $this->addSql('DROP INDEX uid'); | ||
50 | $this->addSql('DROP INDEX hashed_url_user_id'); | ||
51 | $this->addSql('DROP INDEX hashed_given_url_user_id'); | ||
52 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('entry', true) . ' AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM "' . $this->getTable('entry', true) . '"'); | ||
53 | $this->addSql('DROP TABLE "' . $this->getTable('entry', true) . '"'); | ||
54 | $this->addSql('CREATE TABLE "' . $this->getTable('entry', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, mimetype CLOB DEFAULT NULL, language CLOB DEFAULT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, http_status VARCHAR(3) DEFAULT NULL, hashed_url CLOB DEFAULT NULL COLLATE BINARY, hashed_given_url CLOB DEFAULT NULL COLLATE BINARY, published_by CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, headers CLOB DEFAULT NULL COLLATE BINARY)'); | ||
55 | $this->addSql('INSERT INTO "' . $this->getTable('entry', true) . '" (id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers) SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM __temp__' . $this->getTable('entry', true) . ''); | ||
56 | $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); | ||
57 | $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON "' . $this->getTable('entry', true) . '" (user_id)'); | ||
58 | $this->addSql('CREATE INDEX hashed_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_url)'); | ||
59 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_given_url)'); | ||
60 | $this->addSql('CREATE INDEX IDX_entry_starred ON "' . $this->getTable('entry', true) . '" (is_starred)'); | ||
61 | $this->addSql('CREATE INDEX IDX_entry_archived ON "' . $this->getTable('entry', true) . '" (is_archived)'); | ||
62 | $this->addSql('CREATE INDEX IDX_entry_uid ON "' . $this->getTable('entry', true) . '" (uid)'); | ||
63 | $this->addSql('CREATE INDEX IDX_entry_created_at ON "' . $this->getTable('entry', true) . '" (created_at)'); | ||
64 | } | ||
65 | } | ||
diff --git a/app/DoctrineMigrations/Version20190708122957.php b/app/DoctrineMigrations/Version20190708122957.php new file mode 100644 index 00000000..9585e997 --- /dev/null +++ b/app/DoctrineMigrations/Version20190708122957.php | |||
@@ -0,0 +1,22 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Change reading speed value. | ||
10 | */ | ||
11 | final class Version20190708122957 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema): void | ||
14 | { | ||
15 | $this->addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed*200'); | ||
16 | } | ||
17 | |||
18 | public function down(Schema $schema): void | ||
19 | { | ||
20 | $this->addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed/200'); | ||
21 | } | ||
22 | } | ||
diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php new file mode 100644 index 00000000..8b0271b1 --- /dev/null +++ b/app/DoctrineMigrations/Version20190806130304.php | |||
@@ -0,0 +1,116 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Adding more index to kill some slow queries: | ||
10 | * - user_language | ||
11 | * - user_archived | ||
12 | * - user_created | ||
13 | * - user_starred | ||
14 | * - tag_label | ||
15 | * - config_feed_token. | ||
16 | */ | ||
17 | final class Version20190806130304 extends WallabagMigration | ||
18 | { | ||
19 | public function up(Schema $schema): void | ||
20 | { | ||
21 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
22 | case 'sqlite': | ||
23 | $this->addSql('DROP INDEX uid'); | ||
24 | $this->addSql('DROP INDEX created_at'); | ||
25 | $this->addSql('DROP INDEX hashed_url_user_id'); | ||
26 | $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); | ||
27 | $this->addSql('DROP INDEX hashed_given_url_user_id'); | ||
28 | $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url FROM ' . $this->getTable('entry', true)); | ||
29 | $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); | ||
30 | $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:array) | ||
31 | , headers CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:array) | ||
32 | , hashed_url VARCHAR(40) DEFAULT NULL COLLATE BINARY, hashed_given_url VARCHAR(40) DEFAULT NULL COLLATE BINARY, language VARCHAR(20) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
33 | $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url FROM __temp__wallabag_entry'); | ||
34 | $this->addSql('DROP TABLE __temp__wallabag_entry'); | ||
35 | $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); | ||
36 | $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); | ||
37 | $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); | ||
38 | $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); | ||
39 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); | ||
40 | $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)'); | ||
41 | $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)'); | ||
42 | $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry', true) . ' (user_id, created_at)'); | ||
43 | $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); | ||
44 | $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag', true) . ' (label)'); | ||
45 | $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config', true) . ' (feed_token)'); | ||
46 | break; | ||
47 | case 'mysql': | ||
48 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); | ||
49 | $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); | ||
50 | $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); | ||
51 | $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); | ||
52 | $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); | ||
53 | $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label (255))'); | ||
54 | $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token (255))'); | ||
55 | break; | ||
56 | case 'postgresql': | ||
57 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); | ||
58 | $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); | ||
59 | $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); | ||
60 | $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); | ||
61 | $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); | ||
62 | $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label)'); | ||
63 | $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token)'); | ||
64 | break; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | public function down(Schema $schema): void | ||
69 | { | ||
70 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
71 | case 'sqlite': | ||
72 | $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); | ||
73 | $this->addSql('DROP INDEX created_at'); | ||
74 | $this->addSql('DROP INDEX uid'); | ||
75 | $this->addSql('DROP INDEX hashed_url_user_id'); | ||
76 | $this->addSql('DROP INDEX hashed_given_url_user_id'); | ||
77 | $this->addSql('DROP INDEX user_language'); | ||
78 | $this->addSql('DROP INDEX user_archived'); | ||
79 | $this->addSql('DROP INDEX user_created'); | ||
80 | $this->addSql('DROP INDEX user_starred'); | ||
81 | $this->addSql('DROP INDEX tag_label'); | ||
82 | $this->addSql('DROP INDEX config_feed_token'); | ||
83 | $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM ' . $this->getTable('entry', true)); | ||
84 | $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); | ||
85 | $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, hashed_url VARCHAR(40) DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) | ||
86 | , starred_at DATETIME DEFAULT NULL, mimetype CLOB DEFAULT NULL, reading_time INTEGER NOT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, http_status VARCHAR(3) DEFAULT NULL, headers CLOB DEFAULT NULL --(DC2Type:array) | ||
87 | , language CLOB DEFAULT NULL COLLATE BINARY)'); | ||
88 | $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers) SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM __temp__wallabag_entry'); | ||
89 | $this->addSql('DROP TABLE __temp__wallabag_entry'); | ||
90 | $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); | ||
91 | $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); | ||
92 | $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); | ||
93 | $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); | ||
94 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); | ||
95 | break; | ||
96 | case 'mysql': | ||
97 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL'); | ||
98 | $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); | ||
99 | $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); | ||
100 | $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); | ||
101 | $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); | ||
102 | $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag')); | ||
103 | $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config')); | ||
104 | break; | ||
105 | case 'postgresql': | ||
106 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); | ||
107 | $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); | ||
108 | $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); | ||
109 | $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); | ||
110 | $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); | ||
111 | $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag')); | ||
112 | $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config')); | ||
113 | break; | ||
114 | } | ||
115 | } | ||
116 | } | ||
diff --git a/app/DoctrineMigrations/Version20190808124957.php b/app/DoctrineMigrations/Version20190808124957.php new file mode 100644 index 00000000..4e12e995 --- /dev/null +++ b/app/DoctrineMigrations/Version20190808124957.php | |||
@@ -0,0 +1,42 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Change the internal setting table name. | ||
10 | */ | ||
11 | final class Version20190808124957 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema): void | ||
14 | { | ||
15 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
16 | case 'sqlite': | ||
17 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting', true) . ' RENAME TO ' . $this->getTable('internal_setting', true)); | ||
18 | break; | ||
19 | case 'mysql': | ||
20 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME ' . $this->getTable('internal_setting')); | ||
21 | break; | ||
22 | case 'postgresql': | ||
23 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting')); | ||
24 | break; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | public function down(Schema $schema): void | ||
29 | { | ||
30 | switch ($this->connection->getDatabasePlatform()->getName()) { | ||
31 | case 'sqlite': | ||
32 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting', true) . ' RENAME TO ' . $this->getTable('craue_config_setting', true)); | ||
33 | break; | ||
34 | case 'mysql': | ||
35 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME ' . $this->getTable('craue_config_setting')); | ||
36 | break; | ||
37 | case 'postgresql': | ||
38 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting')); | ||
39 | break; | ||
40 | } | ||
41 | } | ||
42 | } | ||