aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-05-09 15:21:21 +0300
committerGitHub <noreply@github.com>2019-05-09 15:21:21 +0300
commit6e67f41152ad025e74696e7140de0f9fb0d601de (patch)
tree5d87be5998bedfc2e25099be17fdc1f3e5cc45ed /app/DoctrineMigrations
parent522e37ad274361dde697da13a92ff3f846599822 (diff)
parent68a90821a305867e9b655da2dbfe558d37253990 (diff)
downloadwallabag-6e67f41152ad025e74696e7140de0f9fb0d601de.tar.gz
wallabag-6e67f41152ad025e74696e7140de0f9fb0d601de.tar.zst
wallabag-6e67f41152ad025e74696e7140de0f9fb0d601de.zip
Merge pull request #3223 from wallabag/rss2atom
Changed RSS to Atom feed and improve paging
Diffstat (limited to 'app/DoctrineMigrations')
-rw-r--r--app/DoctrineMigrations/Version20190425115043.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20190425115043.php b/app/DoctrineMigrations/Version20190425115043.php
new file mode 100644
index 00000000..4c5c49cc
--- /dev/null
+++ b/app/DoctrineMigrations/Version20190425115043.php
@@ -0,0 +1,58 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Rename rss_token & rss_limit to feed_token & feed_limit.
10 */
11final 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 "wallabag_user" (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}