From 7975395d10bb381de8cd15b5ee15198318af6d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Viande?= Date: Wed, 11 Apr 2018 11:42:52 +0200 Subject: Entry: add archived_at property and updateArchived method --- app/DoctrineMigrations/Version20180405182455.php | 68 ++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 app/DoctrineMigrations/Version20180405182455.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php new file mode 100755 index 00000000..71879c0e --- /dev/null +++ b/app/DoctrineMigrations/Version20180405182455.php @@ -0,0 +1,68 @@ +container = $container; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf($entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('archived_at', 'datetime', [ + 'notnull' => false, + ]); + } + + public function postUp(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + $this->skipIf(!$entryTable->hasColumn('archived_at'), 'Unable to add archived_at colum'); + + $this->connection->executeQuery( + 'UPDATE ' . $this->getTable('entry') . ' SET archived_at = updated_at WHERE is_archived = :is_archived', + [ + 'is_archived' => true, + ] + ); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.'); + + $entryTable->dropColumn('archived_at'); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } +} -- cgit v1.2.3 From 877787e5fe6a6545105616968939949b4db81347 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 28 Nov 2018 20:26:18 +0100 Subject: Fix utf8mb4 on vendor tables When creating the schema for test these tables use default length for string: 255. Which fail when using utf8mb4. > Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Also move the `setKeepStaticConnections` in before and after class to avoid: > SAVEPOINT DOCTRINE2_SAVEPOINT_2 does not exist See https://github.com/dmaicher/doctrine-test-bundle#troubleshooting --- app/DoctrineMigrations/Version20180405182455.php | 21 ++--------- app/DoctrineMigrations/Version20181128203230.php | 45 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 app/DoctrineMigrations/Version20181128203230.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php index 71879c0e..50fe97c7 100755 --- a/app/DoctrineMigrations/Version20180405182455.php +++ b/app/DoctrineMigrations/Version20180405182455.php @@ -2,26 +2,14 @@ namespace Application\Migrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** * Add archived_at column and set its value to updated_at for is_archived entries. */ -class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface +class Version20180405182455 extends WallabagMigration { - /** - * @var ContainerInterface - */ - private $container; - - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; - } - /** * @param Schema $schema */ @@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI $entryTable->dropColumn('archived_at'); } - - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix') . $tableName; - } } diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php new file mode 100644 index 00000000..d1b09fc7 --- /dev/null +++ b/app/DoctrineMigrations/Version20181128203230.php @@ -0,0 +1,45 @@ +skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)'); + } + + public function down(Schema $schema) + { + $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)'); + } +} -- cgit v1.2.3 From 1e0d8ad7b728f6fb2cd886526b0fb84ef803e84f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 17 Jan 2019 14:28:05 +0100 Subject: Enable PHPStan - Fix error for level 0 & 1 (level 7 has 699 errors...) - Add `updated_at` to site_credential (so the `timestamps()` method applies correctly) --- app/DoctrineMigrations/Version20190117131816.php | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190117131816.php (limited to 'app/DoctrineMigrations') 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 @@ +getTable($this->getTable('site_credential')); + + $this->skipIf($siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.'); + + $siteCredentialTable->addColumn('updated_at', 'datetime', [ + 'notnull' => false, + ]); + } + + public function down(Schema $schema): void + { + $siteCredentialTable = $schema->getTable($this->getTable('site_credential')); + + $this->skipIf(!$siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.'); + + $siteCredentialTable->dropColumn('updated_at'); + } +} -- cgit v1.2.3 From a6b242a1fd6f8900d80354361449f1bf62506ef9 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 2 Dec 2018 12:43:05 +0100 Subject: Enable OTP 2FA - Update SchebTwoFactorBundle to version 3 - Enable Google 2fa on the bundle - Disallow ability to use both email and google as 2fa - Update Ocramius Proxy Manager to handle typed function & attributes (from PHP 7) - use `$this->addFlash` shortcut instead of `$this->get('session')->getFlashBag()->add` - update admin to be able to create/reset the 2fa --- app/DoctrineMigrations/Version20181202073750.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/DoctrineMigrations/Version20181202073750.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php new file mode 100644 index 00000000..a2308b99 --- /dev/null +++ b/app/DoctrineMigrations/Version20181202073750.php @@ -0,0 +1,22 @@ +addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL'); + } +} -- cgit v1.2.3 From dfd0a7bc5feb4fd7b77d7e2f3a25c5c3febc1eba Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 3 Dec 2018 06:51:06 +0100 Subject: Add backup codes --- app/DoctrineMigrations/Version20181202073750.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php index a2308b99..b6ad8bd7 100644 --- a/app/DoctrineMigrations/Version20181202073750.php +++ b/app/DoctrineMigrations/Version20181202073750.php @@ -12,11 +12,29 @@ final class Version20181202073750 extends WallabagMigration { public function up(Schema $schema): void { - $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted'); + $tableName = $this->getTable('annotation'); + + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted, ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\''); + break; + case 'postgresql': + break; + } } public function down(Schema $schema): void { - $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL'); + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + break; + case 'mysql': + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL, DROP backupCodes'); + break; + case 'postgresql': + break; + } } } -- cgit v1.2.3 From 842af5c3571c5318ae4e1c81dc52457fbf6d3f21 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 5 Dec 2018 11:39:51 +0100 Subject: Add SQLite & PG migration Also remove the forced `server_version` from dbal config to avoid an hard overriding across all database. --- app/DoctrineMigrations/Version20181202073750.php | 46 +++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php index b6ad8bd7..5978291e 100644 --- a/app/DoctrineMigrations/Version20181202073750.php +++ b/app/DoctrineMigrations/Version20181202073750.php @@ -6,21 +6,39 @@ use Doctrine\DBAL\Schema\Schema; use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** - * Add 2fa OTP (named google authenticator). + * Add 2fa OTP stuff. */ final class Version20181202073750 extends WallabagMigration { public function up(Schema $schema): void { - $tableName = $this->getTable('annotation'); - switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite': + $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297'); + $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF'); + $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8'); + $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) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('user', true) . ''); + $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) + , googleAuthenticatorSecret VARCHAR(255) DEFAULT NULL, backupCodes CLOB DEFAULT NULL --(DC2Type:json_array) + )'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . ''); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON ' . $this->getTable('user', true) . ' (confirmation_token)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON ' . $this->getTable('user', true) . ' (email_canonical)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON ' . $this->getTable('user', true) . ' (username_canonical)'); break; case 'mysql': - $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted, ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\''); break; case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN twofactorauthentication TO emailTwoFactor'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes TEXT DEFAULT NULL'); break; } } @@ -29,11 +47,29 @@ final class Version20181202073750 extends WallabagMigration { switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite': + $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8'); + $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF'); + $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297'); + $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) . '"'); + $this->addSql('DROP TABLE "' . $this->getTable('user', true) . '"'); + $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)'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . ''); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "' . $this->getTable('user', true) . '" (username_canonical)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "' . $this->getTable('user', true) . '" (email_canonical)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "' . $this->getTable('user', true) . '" (confirmation_token)'); break; case 'mysql': - $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL, DROP backupCodes'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` ADD trusted TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP backupCodes'); break; case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP googleAuthenticatorSecret'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN emailTwoFactor TO twofactorauthentication'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD trusted TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP backupCodes'); break; } } -- cgit v1.2.3 From c2efb5a3069b59341667626beb0fd6223a98189d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 29 Jan 2019 14:24:38 +0100 Subject: Add missing entries in craue_config_setting. Should fix https://github.com/wallabag/wallabag/issues/3662 --- app/DoctrineMigrations/Version20190129120000.php | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190129120000.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php new file mode 100644 index 00000000..61e0ef4c --- /dev/null +++ b/app/DoctrineMigrations/Version20190129120000.php @@ -0,0 +1,74 @@ + "carrot", "value" => "1", "section" => "entry"), + array("name" => "share_diaspora", "value" => "1", "section" => "entry"), + array("name" => "diaspora_url", "value" => "http://diasporapod.com", "section" => "entry"), + array("name" => "share_shaarli", "value" => "1", "section" => "entry"), + array("name" => "shaarli_url", "value" => "http://myshaarli.com", "section" => "entry"), + array("name" => "share_mail", "value" => "1", "section" => "entry"), + array("name" => "share_twitter", "value" => "1", "section" => "entry"), + array("name" => "show_printlink", "value" => "1", "section" => "entry"), + array("name" => "export_epub", "value" => "1", "section" => "export"), + array("name" => "export_mobi", "value" => "1", "section" => "export"), + array("name" => "export_pdf", "value" => "1", "section" => "export"), + array("name" => "export_csv", "value" => "1", "section" => "export"), + array("name" => "export_json", "value" => "1", "section" => "export"), + array("name" => "export_txt", "value" => "1", "section" => "export"), + array("name" => "export_xml", "value" => "1", "section" => "export"), + array("name" => "piwik_enabled", "value" => "0", "section" => "analytics"), + array("name" => "piwik_host", "value" => "v2.wallabag.org", "section" => "analytics"), + array("name" => "piwik_site_id", "value" => "1", "section" => "analytics"), + array("name" => "demo_mode_enabled", "value" => "0", "section" => "misc"), + array("name" => "demo_mode_username", "value" => "wallabag", "section" => "misc"), + array("name" => "wallabag_support_url", "value" => "https://www.wallabag.org/pages/support.html", "section" => "misc"), + ); + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $piwikEnabled = $this->container + ->get('doctrine.orm.default_entity_manager') + ->getConnection() + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'piwik_enabled'"); + + $this->skipIf(false !== $piwikEnabled, 'It seems that you already played this migration, or user the wallabag:install command.'); + + foreach ($this->settings as $setting) { + $this->addSql(" + INSERT INTO " . $this->getTable('craue_config_setting') . " + (name, value, section) + VALUES ( + '" . $setting['name'] . "', + '" . $setting['value'] . "', + '" . $setting['section'] . "' + ); + "); + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + foreach ($this->settings as $setting) { + $this->addSql(" + DELETE FROM " . $this->getTable('craue_config_setting') . " + WHERE name = '" . $setting['name'] . "'; + "); + } + } +} -- cgit v1.2.3 From fcd54e2447332a681f5b1fde7e737ea5a8975823 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 27 Feb 2019 13:39:17 +0100 Subject: Test each internal settings before creating them --- app/DoctrineMigrations/Version20190129120000.php | 160 +++++++++++++++++------ 1 file changed, 119 insertions(+), 41 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php index 61e0ef4c..5f25d67d 100644 --- a/app/DoctrineMigrations/Version20190129120000.php +++ b/app/DoctrineMigrations/Version20190129120000.php @@ -8,54 +8,132 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** * Add missing entries in craue_config_setting. */ -class Version20190129120000 extends WallabagMigration +final class Version20190129120000 extends WallabagMigration { - var $settings = array( - array("name" => "carrot", "value" => "1", "section" => "entry"), - array("name" => "share_diaspora", "value" => "1", "section" => "entry"), - array("name" => "diaspora_url", "value" => "http://diasporapod.com", "section" => "entry"), - array("name" => "share_shaarli", "value" => "1", "section" => "entry"), - array("name" => "shaarli_url", "value" => "http://myshaarli.com", "section" => "entry"), - array("name" => "share_mail", "value" => "1", "section" => "entry"), - array("name" => "share_twitter", "value" => "1", "section" => "entry"), - array("name" => "show_printlink", "value" => "1", "section" => "entry"), - array("name" => "export_epub", "value" => "1", "section" => "export"), - array("name" => "export_mobi", "value" => "1", "section" => "export"), - array("name" => "export_pdf", "value" => "1", "section" => "export"), - array("name" => "export_csv", "value" => "1", "section" => "export"), - array("name" => "export_json", "value" => "1", "section" => "export"), - array("name" => "export_txt", "value" => "1", "section" => "export"), - array("name" => "export_xml", "value" => "1", "section" => "export"), - array("name" => "piwik_enabled", "value" => "0", "section" => "analytics"), - array("name" => "piwik_host", "value" => "v2.wallabag.org", "section" => "analytics"), - array("name" => "piwik_site_id", "value" => "1", "section" => "analytics"), - array("name" => "demo_mode_enabled", "value" => "0", "section" => "misc"), - array("name" => "demo_mode_username", "value" => "wallabag", "section" => "misc"), - array("name" => "wallabag_support_url", "value" => "https://www.wallabag.org/pages/support.html", "section" => "misc"), - ); + private $settings = [ + [ + 'name' => 'carrot', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'share_diaspora', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'diaspora_url', + 'value' => 'http://diasporapod.com', + 'section' => 'entry', + ], + [ + 'name' => 'share_shaarli', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'shaarli_url', + 'value' => 'http://myshaarli.com', + 'section' => 'entry', + ], + [ + 'name' => 'share_mail', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'share_twitter', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'show_printlink', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'export_epub', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_mobi', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_pdf', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_csv', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_json', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_txt', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_xml', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'piwik_enabled', + 'value' => '0', + 'section' => 'analytics', + ], + [ + 'name' => 'piwik_host', + 'value' => 'v2.wallabag.org', + 'section' => 'analytics', + ], + [ + 'name' => 'piwik_site_id', + 'value' => '1', + 'section' => 'analytics', + ], + [ + 'name' => 'demo_mode_enabled', + 'value' => '0', + 'section' => 'misc', + ], + [ + 'name' => 'demo_mode_username', + 'value' => 'wallabag', + 'section' => 'misc', + ], + [ + 'name' => 'wallabag_support_url', + 'value' => 'https://www.wallabag.org/pages/support.html', + 'section' => 'misc', + ], + ]; /** * @param Schema $schema */ public function up(Schema $schema) { - $piwikEnabled = $this->container - ->get('doctrine.orm.default_entity_manager') - ->getConnection() - ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'piwik_enabled'"); + foreach ($this->settings as $setting) { + $settingEnabled = $this->container + ->get('doctrine.orm.default_entity_manager') + ->getConnection() + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'"); - $this->skipIf(false !== $piwikEnabled, 'It seems that you already played this migration, or user the wallabag:install command.'); + if (false !== $settingEnabled) { + continue; + } - foreach ($this->settings as $setting) { - $this->addSql(" - INSERT INTO " . $this->getTable('craue_config_setting') . " - (name, value, section) - VALUES ( - '" . $setting['name'] . "', - '" . $setting['value'] . "', - '" . $setting['section'] . "' - ); - "); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');"); } } @@ -65,8 +143,8 @@ class Version20190129120000 extends WallabagMigration public function down(Schema $schema) { foreach ($this->settings as $setting) { - $this->addSql(" - DELETE FROM " . $this->getTable('craue_config_setting') . " + $this->addSql(' + DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'; "); } -- cgit v1.2.3 From 85403dae0463660f86de68970dcd1a5cbe784a31 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 1 Mar 2019 20:26:51 +0100 Subject: Disable down for that migration --- app/DoctrineMigrations/Version20190129120000.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php index 5f25d67d..3632e762 100644 --- a/app/DoctrineMigrations/Version20190129120000.php +++ b/app/DoctrineMigrations/Version20190129120000.php @@ -142,11 +142,6 @@ final class Version20190129120000 extends WallabagMigration */ public function down(Schema $schema) { - foreach ($this->settings as $setting) { - $this->addSql(' - DELETE FROM ' . $this->getTable('craue_config_setting') . " - WHERE name = '" . $setting['name'] . "'; - "); - } + $this->skipIf(true, 'These settings are required and should not be removed.'); } } -- cgit v1.2.3 From 9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 11:50:33 +0200 Subject: Keep url in exists endpoint - Add migration - Use md5 instead of sha512 (we don't need security here, just a hash) - Update tests --- app/DoctrineMigrations/Version20190401105353.php | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190401105353.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php new file mode 100644 index 00000000..4afc8b15 --- /dev/null +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -0,0 +1,44 @@ +getTable($this->getTable('entry')); + + $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('hashed_url', 'text', [ + 'length' => 32, + 'notnull' => false, + ]); + + // sqlite doesn't have the MD5 function by default + if ('sqlite' !== $this->connection->getDatabasePlatform()->getName()) { + $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET hashed_url = MD5(url)'); + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); + + $entryTable->dropColumn('hashed_url'); + } +} -- cgit v1.2.3 From 8a6456629814039cfc623cdb279bcba06dacff50 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 13:51:57 +0200 Subject: Use a better index for hashed_url It'll most often be used in addition to the `user_id`. Also, automatically generate the hash when saving the url. Switch from `md5` to `sha1`. --- app/DoctrineMigrations/Version20190401105353.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php index 4afc8b15..c1c22053 100644 --- a/app/DoctrineMigrations/Version20190401105353.php +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -20,7 +20,7 @@ class Version20190401105353 extends WallabagMigration $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); $entryTable->addColumn('hashed_url', 'text', [ - 'length' => 32, + 'length' => 40, 'notnull' => false, ]); @@ -28,6 +28,8 @@ class Version20190401105353 extends WallabagMigration if ('sqlite' !== $this->connection->getDatabasePlatform()->getName()) { $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET hashed_url = MD5(url)'); } + + $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id'); } /** @@ -39,6 +41,7 @@ class Version20190401105353 extends WallabagMigration $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); + $entryTable->dropIndex('hashed_url_user_id'); $entryTable->dropColumn('hashed_url'); } } -- cgit v1.2.3 From c579ce2306297674c56376a2ab5c8ba66a272253 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 14:34:20 +0200 Subject: Some cleanup Also, do not run the hashed_url migration into a Doctrine migration --- app/DoctrineMigrations/Version20190401105353.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php index c1c22053..94ebb1ab 100644 --- a/app/DoctrineMigrations/Version20190401105353.php +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -24,11 +24,6 @@ class Version20190401105353 extends WallabagMigration 'notnull' => false, ]); - // sqlite doesn't have the MD5 function by default - if ('sqlite' !== $this->connection->getDatabasePlatform()->getName()) { - $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET hashed_url = MD5(url)'); - } - $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id'); } -- cgit v1.2.3 From 5cc0646e66f52448f83a7a458e0b60b4580e83e5 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 15:45:17 +0200 Subject: Fix index on MySQL --- app/DoctrineMigrations/Version20190401105353.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php index 94ebb1ab..d27962db 100644 --- a/app/DoctrineMigrations/Version20190401105353.php +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -24,7 +24,7 @@ class Version20190401105353 extends WallabagMigration 'notnull' => false, ]); - $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id'); + $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); } /** -- cgit v1.2.3 From f277bc042c8e805aab14b31b5b51e2878d80c6f4 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 25 Apr 2019 14:12:56 +0200 Subject: Fix tests & cs & migration --- app/DoctrineMigrations/Version20190425115043.php | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190425115043.php (limited to 'app/DoctrineMigrations') 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 @@ +connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); + $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)); + $this->addSql('DROP TABLE ' . $this->getTable('config', true)); + $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)'); + $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)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); + $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_token feed_token VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_limit feed_limit INT DEFAULT NULL'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_token TO feed_token'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_limit TO feed_limit'); + break; + } + } + + public function down(Schema $schema): void + { + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); + $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) . '"'); + $this->addSql('DROP TABLE "' . $this->getTable('config', true) . '"'); + $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)'); + $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)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); + $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "' . $this->getTable('config', true) . '" (user_id)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_token rss_token'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_limit rss_limit'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_token TO rss_token'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_limit TO rss_limit'); + break; + } + } +} -- cgit v1.2.3 From 637f0df9760b50b56c8ffb200719907032fdd885 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 10 May 2019 16:49:19 +0200 Subject: Cascade delete on oauth2 table when deleting a user --- app/DoctrineMigrations/Version20190510141130.php | 95 ++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190510141130.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php new file mode 100644 index 00000000..adfe73a0 --- /dev/null +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -0,0 +1,95 @@ +connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX IDX_368A4209A76ED395'); + $this->addSql('DROP INDEX IDX_368A420919EB6921'); + $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true) . ''); + $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ''); + $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); + $this->addSql('CREATE INDEX IDX_368A420919EB6921 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (client_id)'); + + $this->addSql('DROP INDEX IDX_635D765EA76ED395'); + $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) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true) . ''); + $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 --(DC2Type:array), allowed_grant_types CLOB NOT NULL --(DC2Type:array), CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true) . ''); + $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)'); + + $this->addSql('DROP INDEX IDX_20C9FB24A76ED395'); + $this->addSql('DROP INDEX IDX_20C9FB2419EB6921'); + $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); + $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) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); + $this->addSql('CREATE INDEX IDX_20C9FB2419EB6921 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (client_id)'); + + $this->addSql('DROP INDEX IDX_EE52E3FAA76ED395'); + $this->addSql('DROP INDEX IDX_EE52E3FA19EB6921'); + $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); + $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) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true) . ''); + $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ''); + $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); + $this->addSql('CREATE INDEX IDX_EE52E3FA19EB6921 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (client_id)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP FOREIGN KEY FK_368A4209A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP FOREIGN KEY IDX_user_oauth_client'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id)'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP FOREIGN KEY FK_20C9FB24A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP FOREIGN KEY FK_EE52E3FAA76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP CONSTRAINT FK_368A4209A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP CONSTRAINT idx_user_oauth_client'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP CONSTRAINT FK_20C9FB24A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP CONSTRAINT FK_EE52E3FAA76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + break; + } + } + + public function down(Schema $schema): void + { + throw new SkipMigrationException('Too complex ...'); + } +} -- cgit v1.2.3 From d2ef2d6df8db302dd53af5cf960a101b4301cdc8 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 10 May 2019 20:36:25 +0200 Subject: Fix SQLite migration --- app/DoctrineMigrations/Version20190510141130.php | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php index adfe73a0..5fc1dba4 100644 --- a/app/DoctrineMigrations/Version20190510141130.php +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -22,40 +22,41 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX IDX_368A4209A76ED395'); $this->addSql('DROP INDEX IDX_368A420919EB6921'); $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true) . ''); + $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)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true)); $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $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) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ''); + $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)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); $this->addSql('CREATE INDEX IDX_368A420919EB6921 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (client_id)'); $this->addSql('DROP INDEX IDX_635D765EA76ED395'); - $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) . ''); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true) . ''); - $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 --(DC2Type:array), allowed_grant_types CLOB NOT NULL --(DC2Type:array), CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $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) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true) . ''); + $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)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true)); + $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 "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true)); $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)'); $this->addSql('DROP INDEX IDX_20C9FB24A76ED395'); $this->addSql('DROP INDEX IDX_20C9FB2419EB6921'); $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); - $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) . ''); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $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)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true)); $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $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) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $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)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); $this->addSql('CREATE INDEX IDX_20C9FB2419EB6921 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (client_id)'); $this->addSql('DROP INDEX IDX_EE52E3FAA76ED395'); $this->addSql('DROP INDEX IDX_EE52E3FA19EB6921'); $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); - $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) . ''); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true) . ''); + $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)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true)); $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $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) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ''); + $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)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); $this->addSql('CREATE INDEX IDX_EE52E3FA19EB6921 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (client_id)'); break; -- cgit v1.2.3 From 754bf12e6724b1cd6c6d2da85a377cd96865131d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 10 May 2019 21:15:46 +0200 Subject: Fix SQLite constraint --- app/DoctrineMigrations/Version20190510141130.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php index 5fc1dba4..524aa452 100644 --- a/app/DoctrineMigrations/Version20190510141130.php +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -24,7 +24,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true)); - $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); @@ -43,7 +43,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true)); - $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); @@ -54,7 +54,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true)); - $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) NOT 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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); -- cgit v1.2.3 From feb239ea1006685ab3862c988309a1a5a9659559 Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Sat, 11 May 2019 20:07:38 +0200 Subject: mysql: change collation of tag table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit utf8mb4_unicode_ci considers that 'caché' is equal to 'cache' which can lead to attaching incorrect tags to entries. This issue is due to some unicode normalization done by MySQL. utf8mb4_bin makes no unicode normalization, letting wallabag to consider 'cache' and 'caché' as two different tags. We change the collation of the whole table as Doctrine does not support setting a collation on a column for a specific platform (it tries to apply utf8mb4_bin even for pgsql and sqlite). Fixes #3302 Signed-off-by: Kevin Decherf --- app/DoctrineMigrations/Version20190511165128.php | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190511165128.php (limited to 'app/DoctrineMigrations') 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 @@ +skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); + + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;'); + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;'); + } + + public function down(Schema $schema): void + { + $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); + + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + } +} -- cgit v1.2.3 From b7fa51ae7dd5fef2d9459100c88479413ddd3fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 10 Jul 2017 21:32:25 +0200 Subject: Added given_url in entry table - Added index on entry table for given_url field - Fix tests: The previous `bit.ly` url redirected to doc.wallabag but that url doesn't exist in the fixtures. I used our own internal "redirector" to create a redirect to an url which exist in the fixtures. Also, updating current migration to use the new `WallabagMigration`. --- app/DoctrineMigrations/Version20170710125843.php | 38 +++++++++++++++++++ app/DoctrineMigrations/Version20171218135243.php | 48 ++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 app/DoctrineMigrations/Version20170710125843.php create mode 100644 app/DoctrineMigrations/Version20171218135243.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20170710125843.php b/app/DoctrineMigrations/Version20170710125843.php new file mode 100644 index 00000000..2cf8647a --- /dev/null +++ b/app/DoctrineMigrations/Version20170710125843.php @@ -0,0 +1,38 @@ +getTable($this->getTable('entry')); + + $this->skipIf($entryTable->hasColumn('given_url'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('given_url', 'text', [ + 'notnull' => false, + ]); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('given_url'), 'It seems that you already played this migration.'); + + $entryTable->dropColumn('given_url'); + } +} diff --git a/app/DoctrineMigrations/Version20171218135243.php b/app/DoctrineMigrations/Version20171218135243.php new file mode 100644 index 00000000..3060c920 --- /dev/null +++ b/app/DoctrineMigrations/Version20171218135243.php @@ -0,0 +1,48 @@ +getTable($this->getTable('entry')); + $this->skipIf($entryTable->hasIndex($this->indexGivenUrl), 'It seems that you already played this migration.'); + + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url, given_url, user_id);'; + break; + case 'mysql': + $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url (255), given_url (255), user_id);'; + break; + case 'postgresql': + $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url, given_url, user_id);'; + break; + } + + $this->addSql($sql); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + $this->skipIf(false === $entryTable->hasIndex($this->indexGivenUrl), 'It seems that you already played this migration.'); + + $entryTable->dropIndex($this->indexGivenUrl); + } +} -- cgit v1.2.3 From f3bfb875e94021a93e24a41fbc0f8d86d4dee378 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 29 May 2019 14:18:04 +0200 Subject: Use hash given url to avoid duplicate Using hashed url we can ensure an index on them to ensure it's fast. --- app/DoctrineMigrations/Version20170710125843.php | 38 ------------ app/DoctrineMigrations/Version20171218135243.php | 48 --------------- app/DoctrineMigrations/Version20190601125843.php | 74 ++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 86 deletions(-) delete mode 100644 app/DoctrineMigrations/Version20170710125843.php delete mode 100644 app/DoctrineMigrations/Version20171218135243.php create mode 100644 app/DoctrineMigrations/Version20190601125843.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20170710125843.php b/app/DoctrineMigrations/Version20170710125843.php deleted file mode 100644 index 2cf8647a..00000000 --- a/app/DoctrineMigrations/Version20170710125843.php +++ /dev/null @@ -1,38 +0,0 @@ -getTable($this->getTable('entry')); - - $this->skipIf($entryTable->hasColumn('given_url'), 'It seems that you already played this migration.'); - - $entryTable->addColumn('given_url', 'text', [ - 'notnull' => false, - ]); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $entryTable = $schema->getTable($this->getTable('entry')); - - $this->skipIf(!$entryTable->hasColumn('given_url'), 'It seems that you already played this migration.'); - - $entryTable->dropColumn('given_url'); - } -} diff --git a/app/DoctrineMigrations/Version20171218135243.php b/app/DoctrineMigrations/Version20171218135243.php deleted file mode 100644 index 3060c920..00000000 --- a/app/DoctrineMigrations/Version20171218135243.php +++ /dev/null @@ -1,48 +0,0 @@ -getTable($this->getTable('entry')); - $this->skipIf($entryTable->hasIndex($this->indexGivenUrl), 'It seems that you already played this migration.'); - - switch ($this->connection->getDatabasePlatform()->getName()) { - case 'sqlite': - $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url, given_url, user_id);'; - break; - case 'mysql': - $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url (255), given_url (255), user_id);'; - break; - case 'postgresql': - $sql = 'CREATE UNIQUE INDEX ' . $this->indexGivenUrl . ' ON ' . $this->getTable('entry') . ' (url, given_url, user_id);'; - break; - } - - $this->addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $entryTable = $schema->getTable($this->getTable('entry')); - $this->skipIf(false === $entryTable->hasIndex($this->indexGivenUrl), 'It seems that you already played this migration.'); - - $entryTable->dropIndex($this->indexGivenUrl); - } -} diff --git a/app/DoctrineMigrations/Version20190601125843.php b/app/DoctrineMigrations/Version20190601125843.php new file mode 100644 index 00000000..341d64dc --- /dev/null +++ b/app/DoctrineMigrations/Version20190601125843.php @@ -0,0 +1,74 @@ +getTable($this->getTable('entry')); + + if (!$entryTable->hasColumn('given_url')) { + $entryTable->addColumn('given_url', 'text', [ + 'notnull' => false, + ]); + } + + if (!$entryTable->hasColumn('hashed_given_url')) { + $entryTable->addColumn('hashed_given_url', 'text', [ + 'length' => 40, + 'notnull' => false, + ]); + } + + $entryTable->dropIndex('hashed_url_user_id'); + $entryTable->addIndex( + [ + 'user_id', + 'hashed_url', + 'hashed_given_url', + ], + 'hashed_urls_user_id', + [], + [ + // specify length for index which is required by MySQL on text field + 'lengths' => [ + // user_id + null, + // hashed_url + 40, + // hashed_given_url + 40, + ], + ] + ); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + if ($entryTable->hasColumn('given_url')) { + $entryTable->dropColumn('given_url'); + } + + if ($entryTable->hasColumn('hashed_given_url')) { + $entryTable->dropColumn('hashed_given_url'); + } + + $entryTable->dropIndex('hashed_urls_user_id'); + $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); + } +} -- cgit v1.2.3 From 70df4c335965a9562cc24d3ccea0a6ed1a23b7b1 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 5 Jun 2019 10:51:06 +0200 Subject: Use two indexes instead of one for hashed urls When using `OR` in a where clause, a composite index can't be used. We should use a `UNION` to take advantages of it. Instead, create 2 indexes on each hashed urls and make 2 queries to find an url. It'll be faster than the previous solution. --- app/DoctrineMigrations/Version20190601125843.php | 26 +++--------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190601125843.php b/app/DoctrineMigrations/Version20190601125843.php index 341d64dc..0e97606e 100644 --- a/app/DoctrineMigrations/Version20190601125843.php +++ b/app/DoctrineMigrations/Version20190601125843.php @@ -30,27 +30,8 @@ class Version20190601125843 extends WallabagMigration ]); } - $entryTable->dropIndex('hashed_url_user_id'); - $entryTable->addIndex( - [ - 'user_id', - 'hashed_url', - 'hashed_given_url', - ], - 'hashed_urls_user_id', - [], - [ - // specify length for index which is required by MySQL on text field - 'lengths' => [ - // user_id - null, - // hashed_url - 40, - // hashed_given_url - 40, - ], - ] - ); + // 40 = length of sha1 field hashed_given_url + $entryTable->addIndex(['user_id', 'hashed_given_url'], 'hashed_given_url_user_id', [], ['lengths' => [null, 40]]); } /** @@ -68,7 +49,6 @@ class Version20190601125843 extends WallabagMigration $entryTable->dropColumn('hashed_given_url'); } - $entryTable->dropIndex('hashed_urls_user_id'); - $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); + $entryTable->dropIndex('hashed_given_url_user_id'); } } -- cgit v1.2.3 From 22807de7c556d57f1f4dd13e1ba80e76bc508b97 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 18 Jun 2019 21:57:36 +0200 Subject: Fix migration with prefix table name Looks like we missed one `wallabag_user` in migration. It can work for most people but if someone use a different prefix, it'll break. --- app/DoctrineMigrations/Version20190510141130.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php index 524aa452..ec4d0e45 100644 --- a/app/DoctrineMigrations/Version20190510141130.php +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -24,7 +24,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true)); - $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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); @@ -33,7 +33,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX IDX_635D765EA76ED395'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true)); - $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 "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true)); $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)'); @@ -43,7 +43,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true)); - $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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); @@ -54,7 +54,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true)); - $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 "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); @@ -62,29 +62,29 @@ final class Version20190510141130 extends WallabagMigration break; case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP FOREIGN KEY FK_368A4209A76ED395'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP FOREIGN KEY IDX_user_oauth_client'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id)'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP FOREIGN KEY FK_20C9FB24A76ED395'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP FOREIGN KEY FK_EE52E3FAA76ED395'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + $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'); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP CONSTRAINT FK_368A4209A76ED395'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP CONSTRAINT idx_user_oauth_client'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP CONSTRAINT FK_20C9FB24A76ED395'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP CONSTRAINT FK_EE52E3FAA76ED395'); - $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $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'); break; } } -- cgit v1.2.3 From 227e44d49c4a5c1f9e1216711cd4fe3d40d7690a Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 19 Jun 2019 09:06:58 +0200 Subject: Fix PG migration --- app/DoctrineMigrations/Version20190510141130.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php index ec4d0e45..3c504e8a 100644 --- a/app/DoctrineMigrations/Version20190510141130.php +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -75,16 +75,16 @@ final class Version20190510141130 extends WallabagMigration break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP CONSTRAINT FK_368A4209A76ED395'); - $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'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP CONSTRAINT idx_user_oauth_client'); - $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'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP CONSTRAINT FK_20C9FB24A76ED395'); - $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'); + $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'); $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP CONSTRAINT FK_EE52E3FAA76ED395'); - $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'); + $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'); break; } } -- cgit v1.2.3 From 1f36a21887102b9c3f5545df964bb4b002648718 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 19 Jun 2019 11:44:01 +0200 Subject: Fix `reading_time` being NULL on SQLite --- app/DoctrineMigrations/Version20190619093534.php | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190619093534.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190619093534.php b/app/DoctrineMigrations/Version20190619093534.php new file mode 100644 index 00000000..04c3a9fe --- /dev/null +++ b/app/DoctrineMigrations/Version20190619093534.php @@ -0,0 +1,65 @@ +abortIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); + + $this->addSql('UPDATE ' . $this->getTable('entry', true) . ' SET reading_time = 0 WHERE reading_time IS NULL;'); + + $this->addSql('DROP INDEX hashed_given_url_user_id'); + $this->addSql('DROP INDEX IDX_entry_uid'); + $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); + $this->addSql('DROP INDEX IDX_entry_created_at'); + $this->addSql('DROP INDEX IDX_entry_starred'); + $this->addSql('DROP INDEX IDX_entry_archived'); + $this->addSql('DROP INDEX hashed_url_user_id'); + $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) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('entry', true) . ''); + $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) + , headers CLOB DEFAULT NULL --(DC2Type:array) + , hashed_url VARCHAR(40) DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); + $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); + $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); + $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); + $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); + $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); + + $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); + $this->addSql('DROP INDEX created_at'); + $this->addSql('DROP INDEX uid'); + $this->addSql('DROP INDEX hashed_url_user_id'); + $this->addSql('DROP INDEX hashed_given_url_user_id'); + $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) . '"'); + $this->addSql('DROP TABLE "' . $this->getTable('entry', true) . '"'); + $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)'); + $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) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); + $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON "' . $this->getTable('entry', true) . '" (user_id)'); + $this->addSql('CREATE INDEX hashed_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_url)'); + $this->addSql('CREATE INDEX hashed_given_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_given_url)'); + $this->addSql('CREATE INDEX IDX_entry_starred ON "' . $this->getTable('entry', true) . '" (is_starred)'); + $this->addSql('CREATE INDEX IDX_entry_archived ON "' . $this->getTable('entry', true) . '" (is_archived)'); + $this->addSql('CREATE INDEX IDX_entry_uid ON "' . $this->getTable('entry', true) . '" (uid)'); + $this->addSql('CREATE INDEX IDX_entry_created_at ON "' . $this->getTable('entry', true) . '" (created_at)'); + } +} -- cgit v1.2.3 From c1a5dfe5e4947f97ba7d7d5b73973ddedf3d8b01 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 21 Jun 2019 09:15:35 +0200 Subject: Use `skipIf` instead of `abortIf` This is to avoid migration using an other SGBD to break. --- app/DoctrineMigrations/Version20190619093534.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190619093534.php b/app/DoctrineMigrations/Version20190619093534.php index 04c3a9fe..e9744f1b 100644 --- a/app/DoctrineMigrations/Version20190619093534.php +++ b/app/DoctrineMigrations/Version20190619093534.php @@ -14,7 +14,7 @@ final class Version20190619093534 extends WallabagMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs - $this->abortIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); + $this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); $this->addSql('UPDATE ' . $this->getTable('entry', true) . ' SET reading_time = 0 WHERE reading_time IS NULL;'); @@ -42,7 +42,7 @@ final class Version20190619093534 extends WallabagMigration public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs - $this->abortIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); + $this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); $this->addSql('DROP INDEX created_at'); -- cgit v1.2.3 From b8fa1b13a65f448ce6a8ac0745acc123f4af627e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Jul 2019 13:38:53 +0200 Subject: Fix hardcoded `wallabag_` prefix in migration Again. Looks like there are still some which were missing to be replaced. --- app/DoctrineMigrations/Version20170511211659.php | 26 +++++++++++++----------- app/DoctrineMigrations/Version20190425115043.php | 2 +- app/DoctrineMigrations/Version20190619093534.php | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'app/DoctrineMigrations') 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 { public function up(Schema $schema) { - $tableName = $this->getTable('annotation'); - switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite': + $annotationTableName = $this->getTable('annotation', true); + $userTableName = $this->getTable('user', true); + $entryTableName = $this->getTable('entry', true); + $this->addSql(<<addSql('DROP TABLE ' . $tableName); + $this->addSql('DROP TABLE ' . $annotationTableName); $this->addSql(<<addSql(<<addSql('DROP TABLE __temp__wallabag_annotation'); break; case 'mysql': - $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote TEXT NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' MODIFY quote TEXT NOT NULL'); break; case 'postgresql': - $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE TEXT'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ALTER COLUMN quote TYPE TEXT'); break; } } diff --git a/app/DoctrineMigrations/Version20190425115043.php b/app/DoctrineMigrations/Version20190425115043.php index 4c5c49cc..5c6ae494 100644 --- a/app/DoctrineMigrations/Version20190425115043.php +++ b/app/DoctrineMigrations/Version20190425115043.php @@ -17,7 +17,7 @@ final class Version20190425115043 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('config', true)); - $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)'); + $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)'); $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)); $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)'); diff --git a/app/DoctrineMigrations/Version20190619093534.php b/app/DoctrineMigrations/Version20190619093534.php index e9744f1b..9a062536 100644 --- a/app/DoctrineMigrations/Version20190619093534.php +++ b/app/DoctrineMigrations/Version20190619093534.php @@ -29,7 +29,7 @@ final class Version20190619093534 extends WallabagMigration $this->addSql('DROP TABLE ' . $this->getTable('entry', true) . ''); $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) , headers CLOB DEFAULT NULL --(DC2Type:array) - , hashed_url VARCHAR(40) DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + , 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)'); $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) . ''); $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); -- cgit v1.2.3 From 41022cb289f5d08418ccb2d7050098c4ee3721e4 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 8 Jul 2019 14:45:45 +0200 Subject: Add ability to manually define the reading speed Instead of using a select, let the user decide its own speed. --- app/DoctrineMigrations/Version20190708122957.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190708122957.php (limited to 'app/DoctrineMigrations') 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 @@ +addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed*200'); + } + + public function down(Schema $schema): void + { + $this->addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed/200'); + } +} -- cgit v1.2.3 From d1dbe10e8460b7117c98ee1e02735602887fd3a4 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Mon, 5 Aug 2019 23:29:55 +1000 Subject: Update language in Entry model, and add index Fixes #4080 Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806130304.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190806130304.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php new file mode 100644 index 00000000..27d3ddad --- /dev/null +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -0,0 +1,24 @@ +addSql('ALTER TABLE wallabag_entry CHANGE language language VARCHAR(20) DEFAULT NULL'); + $this->addSql('CREATE INDEX user_language ON wallabag_entry (language, user_id)'); + } + + public function down(Schema $schema) : void + { + $this->addSql('DROP INDEX user_language ON `wallabag_entry`'); + $this->addSql('ALTER TABLE `wallabag_entry` CHANGE language language LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); + } +} -- cgit v1.2.3 From 5071c8c9cf4d3fcb79851e3ea089593c81cd3b02 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Tue, 6 Aug 2019 22:39:12 +1000 Subject: Add index on starred entries Fixes #4079 Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806131006.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190806131006.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806131006.php b/app/DoctrineMigrations/Version20190806131006.php new file mode 100644 index 00000000..7ad45b57 --- /dev/null +++ b/app/DoctrineMigrations/Version20190806131006.php @@ -0,0 +1,22 @@ +addSql('CREATE INDEX user_starred ON wallabag_entry (user_id, is_starred, starred_at)'); + } + + public function down(Schema $schema) : void + { + $this->addSql('DROP INDEX user_starred ON `wallabag_entry`'); + } +} -- cgit v1.2.3 From 24acf2e0f3a6b18c86de6dd7e5efd930aaaad9dd Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 7 Aug 2019 11:25:55 +0200 Subject: Fix migrations --- app/DoctrineMigrations/Version20190806130304.php | 82 +++++++++++++++++++++--- app/DoctrineMigrations/Version20190806131006.php | 22 ------- 2 files changed, 72 insertions(+), 32 deletions(-) delete mode 100644 app/DoctrineMigrations/Version20190806131006.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index 27d3ddad..b1e8f8d0 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -1,24 +1,86 @@ -addSql('ALTER TABLE wallabag_entry CHANGE language language VARCHAR(20) DEFAULT NULL'); - $this->addSql('CREATE INDEX user_language ON wallabag_entry (language, user_id)'); + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX uid'); + $this->addSql('DROP INDEX created_at'); + $this->addSql('DROP INDEX hashed_url_user_id'); + $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); + $this->addSql('DROP INDEX hashed_given_url_user_id'); + $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)); + $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); + $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) + , headers CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:array) + , 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)'); + $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'); + $this->addSql('DROP TABLE __temp__wallabag_entry'); + $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); + $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); + $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); + $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); + $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); + $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); + $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN language VARCHAR(20) DEFAULT NULL'); + $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + break; + } } - public function down(Schema $schema) : void + public function down(Schema $schema): void { - $this->addSql('DROP INDEX user_language ON `wallabag_entry`'); - $this->addSql('ALTER TABLE `wallabag_entry` CHANGE language language LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); + $this->addSql('DROP INDEX created_at'); + $this->addSql('DROP INDEX uid'); + $this->addSql('DROP INDEX hashed_url_user_id'); + $this->addSql('DROP INDEX hashed_given_url_user_id'); + $this->addSql('DROP INDEX user_language'); + $this->addSql('DROP INDEX user_starred'); + $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)); + $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); + $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) + , 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) + , language CLOB DEFAULT NULL COLLATE BINARY)'); + $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'); + $this->addSql('DROP TABLE __temp__wallabag_entry'); + $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); + $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); + $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); + $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); + $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL'); + $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN language LONGTEXT DEFAULT NULL'); + $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); + break; + } } } diff --git a/app/DoctrineMigrations/Version20190806131006.php b/app/DoctrineMigrations/Version20190806131006.php deleted file mode 100644 index 7ad45b57..00000000 --- a/app/DoctrineMigrations/Version20190806131006.php +++ /dev/null @@ -1,22 +0,0 @@ -addSql('CREATE INDEX user_starred ON wallabag_entry (user_id, is_starred, starred_at)'); - } - - public function down(Schema $schema) : void - { - $this->addSql('DROP INDEX user_starred ON `wallabag_entry`'); - } -} -- cgit v1.2.3 From b700b38e1729d50a19ba403004869eb540121ec7 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 7 Aug 2019 11:46:58 +0200 Subject: Fix PG migration --- app/DoctrineMigrations/Version20190806130304.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index b1e8f8d0..1449bdd3 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -40,7 +40,7 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; case 'postgresql': - $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN language VARCHAR(20) DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; @@ -77,7 +77,7 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; case 'postgresql': - $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN language LONGTEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; -- cgit v1.2.3 From 588de419e043bc1d8876552809607721cb256094 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Wed, 7 Aug 2019 21:44:00 +1000 Subject: Add user_archived index Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806130304.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index 1449bdd3..4d6b7897 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -32,16 +32,19 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); break; case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); + $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; } @@ -57,6 +60,7 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX hashed_url_user_id'); $this->addSql('DROP INDEX hashed_given_url_user_id'); $this->addSql('DROP INDEX user_language'); + $this->addSql('DROP INDEX user_archived'); $this->addSql('DROP INDEX user_starred'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); @@ -74,11 +78,13 @@ final class Version20190806130304 extends WallabagMigration case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL'); $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; } -- cgit v1.2.3 From 2b0f4e86b27fec39f5e172fbeba9ce033aef2e79 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Wed, 7 Aug 2019 22:02:37 +1000 Subject: Add user_created index Signed-off-by: Olivier Mehani --- app/DoctrineMigrations/Version20190806130304.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index 4d6b7897..ca94c080 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -33,18 +33,21 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)'); $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)'); + $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry', true) . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); break; case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); + $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); $this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)'); $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); + $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); break; } @@ -61,6 +64,7 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX hashed_given_url_user_id'); $this->addSql('DROP INDEX user_language'); $this->addSql('DROP INDEX user_archived'); + $this->addSql('DROP INDEX user_created'); $this->addSql('DROP INDEX user_starred'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); @@ -79,12 +83,14 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL'); $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); $this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); break; } -- cgit v1.2.3 From 0810c75e0bd2aa008d69da819a7c51207f159854 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 8 Aug 2019 09:36:03 +0200 Subject: Add `tag_label` & `config_feed_token` index --- app/DoctrineMigrations/Version20190806130304.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index ca94c080..c577509d 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -6,7 +6,13 @@ use Doctrine\DBAL\Schema\Schema; use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** - * Adding more index to kill some slow queries. + * Adding more index to kill some slow queries: + * - user_language + * - user_archived + * - user_created + * - user_starred + * - tag_label + * - config_feed_token */ final class Version20190806130304 extends WallabagMigration { @@ -35,6 +41,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry', true) . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); + $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag', true) . ' (label)'); + $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config', true) . ' (feed_token)'); break; case 'mysql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); @@ -42,6 +50,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label (255))'); + $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token (255))'); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); @@ -49,6 +59,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); + $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label)'); + $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token)'); break; } } @@ -66,6 +78,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_archived'); $this->addSql('DROP INDEX user_created'); $this->addSql('DROP INDEX user_starred'); + $this->addSql('DROP INDEX tag_label'); + $this->addSql('DROP INDEX config_feed_token'); $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)); $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); $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) @@ -85,6 +99,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag')); + $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config')); break; case 'postgresql': $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); @@ -92,6 +108,8 @@ final class Version20190806130304 extends WallabagMigration $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); + $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag')); + $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config')); break; } } -- cgit v1.2.3 From 00567d9ccde71eba1aabf8fa0d547897f6870b28 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 8 Aug 2019 11:45:39 +0200 Subject: CS --- app/DoctrineMigrations/Version20190806130304.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php index c577509d..8b0271b1 100644 --- a/app/DoctrineMigrations/Version20190806130304.php +++ b/app/DoctrineMigrations/Version20190806130304.php @@ -12,7 +12,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; * - user_created * - user_starred * - tag_label - * - config_feed_token + * - config_feed_token. */ final class Version20190806130304 extends WallabagMigration { -- cgit v1.2.3 From 1576905e0357ef96cd852ea3c1ff4216af195c34 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 8 Aug 2019 15:19:53 +0200 Subject: Rename internal settings table In fact it's not _just_ a rename. We are now able to use our own entity with the CraueConfigBundle which allow us to enforce a custom length on string field and avoid error with utf8mb4 on MySQL. To fix that issue before we were in need to fork CraueConfigBundle to hard apply these length changes. The recent 2.3.0 release fix that issue. That's why we are in need to rename the table (getting rid of the bundle name from it) Also updating deps: - Updating symfony/polyfill-mbstring (v1.11.0 => v1.12.0) - Updating symfony/polyfill-ctype (v1.11.0 => v1.12.0) - Updating symfony/polyfill-php70 (v1.11.0 => v1.12.0) - Updating symfony/polyfill-util (v1.11.0 => v1.12.0) - Updating symfony/polyfill-php56 (v1.11.0 => v1.12.0) - Updating symfony/polyfill-intl-icu (v1.11.0 => v1.12.0) - Updating symfony/polyfill-apcu (v1.11.0 => v1.12.0) - Updating j0k3r/graby-site-config (1.0.88 => 1.0.89) - Updating php-http/message (1.7.2 => 1.8.0) - Updating symfony/polyfill-php73 (v1.11.0 => v1.12.0) - Updating symfony/http-client (v4.3.2 => v4.3.3) - Updating symfony/polyfill-php72 (v1.11.0 => v1.12.0) - Updating symfony/polyfill-intl-idn (v1.11.0 => v1.12.0) - Updating symfony/mime (v4.3.2 => v4.3.3) - Updating craue/config-bundle (dev-utf8mb4 46cfd37 => 2.3.0) - Updating masterminds/html5 (2.6.0 => 2.7.0) - Updating nette/di (v3.0.0 => v3.0.1) - Updating symfony/polyfill-iconv (v1.11.0 => v1.12.0) - Updating wallabag/php-mobi (1.0.1 => 1.1.0) --- app/DoctrineMigrations/Version20190808124957.php | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190808124957.php (limited to 'app/DoctrineMigrations') 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 @@ +connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting', true) . ' RENAME TO ' . $this->getTable('internal_setting', true)); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME ' . $this->getTable('internal_setting')); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting')); + break; + } + } + + public function down(Schema $schema): void + { + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting', true) . ' RENAME TO ' . $this->getTable('craue_config_setting', true)); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME ' . $this->getTable('craue_config_setting')); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting')); + break; + } + } +} -- cgit v1.2.3 From 8d4ed0df0633f43fc2d65fef72c36070113844d1 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 12 Nov 2019 14:18:58 +0100 Subject: Update deps Also CS (because cs-fixer got an update) Package operations: 0 installs, 26 updates, 0 removals - Updating twig/twig (v2.12.1 => v2.12.2) - Updating symfony/symfony (v3.4.33 => v3.4.34) - Updating doctrine/event-manager (v1.0.0 => 1.1.0) - Updating doctrine/collections (v1.6.2 => 1.6.3) - Updating doctrine/cache (v1.8.1 => 1.9.0) - Updating doctrine/persistence (1.1.1 => 1.2.0) - Updating doctrine/inflector (v1.3.0 => 1.3.1) - Updating symfony/mime (v4.3.5 => v4.3.7) - Updating swiftmailer/swiftmailer (v6.2.1 => v6.2.3) - Updating symfony/swiftmailer-bundle (v3.3.0 => v3.3.1) - Updating doctrine/dbal (v2.9.2 => v2.9.3) - Updating doctrine/instantiator (1.2.0 => 1.3.0) - Updating j0k3r/graby-site-config (1.0.93 => 1.0.94) - Updating phpoption/phpoption (1.5.0 => 1.5.2) - Updating symfony/http-client-contracts (v1.1.7 => v1.1.8) - Updating symfony/http-client (v4.3.5 => v4.3.7) - Updating sensiolabs/security-checker (v6.0.2 => v6.0.3) - Updating paragonie/constant_time_encoding (v2.2.3 => v2.3.0) - Updating scheb/two-factor-bundle (v4.7.1 => v4.8.0) - Updating symfony/phpunit-bridge (v4.3.6 => v4.3.7) - Updating composer/xdebug-handler (1.3.3 => 1.4.0) - Updating friendsofphp/php-cs-fixer (v2.15.3 => v2.16.0) - Updating doctrine/data-fixtures (v1.3.2 => 1.3.3) - Updating nette/schema (v1.0.0 => v1.0.1) - Updating nikic/php-parser (v4.2.4 => v4.3.0) - Updating sentry/sentry (2.2.2 => 2.2.4) --- app/DoctrineMigrations/Version20160401000000.php | 6 ------ app/DoctrineMigrations/Version20160410190541.php | 6 ------ app/DoctrineMigrations/Version20160812120952.php | 6 ------ app/DoctrineMigrations/Version20160911214952.php | 6 ------ app/DoctrineMigrations/Version20160916201049.php | 6 ------ app/DoctrineMigrations/Version20161001072726.php | 6 ------ app/DoctrineMigrations/Version20161022134138.php | 6 ------ app/DoctrineMigrations/Version20161024212538.php | 6 ------ app/DoctrineMigrations/Version20161031132655.php | 6 ------ app/DoctrineMigrations/Version20161104073720.php | 6 ------ app/DoctrineMigrations/Version20161106113822.php | 6 ------ app/DoctrineMigrations/Version20161117071626.php | 6 ------ app/DoctrineMigrations/Version20161118134328.php | 6 ------ app/DoctrineMigrations/Version20161122144743.php | 6 ------ app/DoctrineMigrations/Version20161122203647.php | 6 ------ app/DoctrineMigrations/Version20161128084725.php | 6 ------ app/DoctrineMigrations/Version20161128131503.php | 6 ------ app/DoctrineMigrations/Version20161214094402.php | 6 ------ app/DoctrineMigrations/Version20161214094403.php | 6 ------ app/DoctrineMigrations/Version20170127093841.php | 6 ------ app/DoctrineMigrations/Version20170327194233.php | 6 ------ app/DoctrineMigrations/Version20170405182620.php | 6 ------ app/DoctrineMigrations/Version20170407200919.php | 6 ------ app/DoctrineMigrations/Version20170420134133.php | 6 ------ app/DoctrineMigrations/Version20170501115751.php | 6 ------ app/DoctrineMigrations/Version20170510082609.php | 6 ------ app/DoctrineMigrations/Version20170511115400.php | 6 ------ app/DoctrineMigrations/Version20170602075214.php | 6 ------ app/DoctrineMigrations/Version20170606155640.php | 6 ------ app/DoctrineMigrations/Version20170719231144.php | 6 ------ app/DoctrineMigrations/Version20170824113337.php | 6 ------ app/DoctrineMigrations/Version20171008195606.php | 6 ------ app/DoctrineMigrations/Version20171105202000.php | 6 ------ app/DoctrineMigrations/Version20171120163128.php | 6 ------ app/DoctrineMigrations/Version20171125164500.php | 6 ------ app/DoctrineMigrations/Version20180405182455.php | 6 ------ app/DoctrineMigrations/Version20181128203230.php | 3 --- app/DoctrineMigrations/Version20190129120000.php | 6 ------ app/DoctrineMigrations/Version20190401105353.php | 6 ------ app/DoctrineMigrations/Version20190601125843.php | 6 ------ 40 files changed, 237 deletions(-) (limited to 'app/DoctrineMigrations') 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; */ class Version20160401000000 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $this->skipIf($schema->hasTable($this->getTable('entry')), 'Database already initialized'); @@ -167,9 +164,6 @@ SQL } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20160410190541 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -34,9 +31,6 @@ class Version20160410190541 extends WallabagMigration } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20160812120952 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); @@ -34,9 +31,6 @@ class Version20160812120952 extends WallabagMigration } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20160911214952 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $redis = $this->container @@ -36,9 +33,6 @@ class Version20160911214952 extends WallabagMigration $this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.'); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20160916201049 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $configTable = $schema->getTable($this->getTable('config')); @@ -23,9 +20,6 @@ class Version20160916201049 extends WallabagMigration $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'pocket_consumer_key';"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161001072726 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $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 $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES ' . $this->getTable('entry') . ' (id) ON DELETE CASCADE'); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { 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; */ class Version20161022134138 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); @@ -41,9 +38,6 @@ class Version20161022134138 extends WallabagMigration $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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 { private $constraintName = 'IDX_user_oauth_client'; - /** - * @param Schema $schema - */ public function up(Schema $schema) { $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); @@ -32,9 +29,6 @@ class Version20161024212538 extends WallabagMigration ); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161031132655 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $images = $this->container @@ -25,9 +22,6 @@ class Version20161031132655 extends WallabagMigration $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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 { private $indexName = 'IDX_entry_created_at'; - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -23,9 +20,6 @@ class Version20161104073720 extends WallabagMigration $entryTable->addIndex(['created_at'], $this->indexName); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161106113822 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $configTable = $schema->getTable($this->getTable('config')); @@ -25,9 +22,6 @@ class Version20161106113822 extends WallabagMigration ]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161117071626 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $share = $this->container @@ -36,9 +33,6 @@ class Version20161117071626 extends WallabagMigration $this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.'); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161118134328 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -25,9 +22,6 @@ class Version20161118134328 extends WallabagMigration ]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161122144743 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $access = $this->container @@ -25,9 +22,6 @@ class Version20161122144743 extends WallabagMigration $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161122203647 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $userTable = $schema->getTable($this->getTable('user')); @@ -31,9 +28,6 @@ class Version20161122203647 extends WallabagMigration $userTable->dropColumn('credentials_expired'); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161128084725 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $configTable = $schema->getTable($this->getTable('config')); @@ -21,9 +18,6 @@ class Version20161128084725 extends WallabagMigration $configTable->addColumn('list_mode', 'integer', ['notnull' => false]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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 'expires_at' => 'datetime', ]; - /** - * @param Schema $schema - */ public function up(Schema $schema) { $userTable = $schema->getTable($this->getTable('user')); @@ -29,9 +26,6 @@ class Version20161128131503 extends WallabagMigration } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20161214094402 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -35,9 +32,6 @@ class Version20161214094402 extends WallabagMigration } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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 { private $indexName = 'IDX_entry_uid'; - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -23,9 +20,6 @@ class Version20161214094403 extends WallabagMigration $entryTable->addIndex(['uid'], $this->indexName); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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 private $indexStarredName = 'IDX_entry_starred'; private $indexArchivedName = 'IDX_entry_archived'; - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -25,9 +22,6 @@ class Version20170127093841 extends WallabagMigration $entryTable->addIndex(['is_archived'], $this->indexArchivedName); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170327194233 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $scuttle = $this->container @@ -26,9 +23,6 @@ class Version20170327194233 extends WallabagMigration $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170405182620 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -30,9 +27,6 @@ class Version20170405182620 extends WallabagMigration ]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170407200919 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -21,9 +18,6 @@ class Version20170407200919 extends WallabagMigration $entryTable->dropColumn('is_public'); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170420134133 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures';"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170501115751 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $this->skipIf($schema->hasTable($this->getTable('site_credential')), 'It seems that you already played this migration.'); @@ -34,9 +31,6 @@ class Version20170501115751 extends WallabagMigration } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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 'email_canonical', ]; - /** - * @param Schema $schema - */ public function up(Schema $schema) { $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL'); @@ -29,9 +26,6 @@ class Version20170510082609 extends WallabagMigration } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170511115400 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -24,9 +21,6 @@ class Version20170511115400 extends WallabagMigration ]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); 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; */ class Version20170602075214 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $apiUserRegistration = $this->container @@ -25,9 +22,6 @@ class Version20170602075214 extends WallabagMigration $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170606155640 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $apiUserRegistration = $this->container @@ -26,9 +23,6 @@ class Version20170606155640 extends WallabagMigration $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20170719231144 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $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 ); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { 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; */ class Version20170824113337 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -37,9 +34,6 @@ class Version20170824113337 extends WallabagMigration ); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20171008195606 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $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 } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20171105202000 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -24,9 +21,6 @@ class Version20171105202000 extends WallabagMigration ]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20171120163128 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $storeArticleHeaders = $this->container @@ -25,9 +22,6 @@ class Version20171120163128 extends WallabagMigration $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('store_article_headers', '0', 'entry')"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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; */ class Version20171125164500 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $shaarliShareOriginUrl = $this->container @@ -25,9 +22,6 @@ class Version20171125164500 extends WallabagMigration $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('shaarli_share_origin_url', '0', 'entry')"); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $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 index 50fe97c7..1b8c3b0e 100755 --- a/app/DoctrineMigrations/Version20180405182455.php +++ b/app/DoctrineMigrations/Version20180405182455.php @@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; */ class Version20180405182455 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -37,9 +34,6 @@ class Version20180405182455 extends WallabagMigration ); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php index d1b09fc7..add161cd 100644 --- a/app/DoctrineMigrations/Version20181128203230.php +++ b/app/DoctrineMigrations/Version20181128203230.php @@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; */ class Version20181128203230 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php index 3632e762..8c5e28ca 100644 --- a/app/DoctrineMigrations/Version20190129120000.php +++ b/app/DoctrineMigrations/Version20190129120000.php @@ -118,9 +118,6 @@ final class Version20190129120000 extends WallabagMigration ], ]; - /** - * @param Schema $schema - */ public function up(Schema $schema) { foreach ($this->settings as $setting) { @@ -137,9 +134,6 @@ final class Version20190129120000 extends WallabagMigration } } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $this->skipIf(true, 'These settings are required and should not be removed.'); diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php index d27962db..600fc162 100644 --- a/app/DoctrineMigrations/Version20190401105353.php +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; */ class Version20190401105353 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -27,9 +24,6 @@ class Version20190401105353 extends WallabagMigration $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); diff --git a/app/DoctrineMigrations/Version20190601125843.php b/app/DoctrineMigrations/Version20190601125843.php index 0e97606e..cbb92edc 100644 --- a/app/DoctrineMigrations/Version20190601125843.php +++ b/app/DoctrineMigrations/Version20190601125843.php @@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; */ class Version20190601125843 extends WallabagMigration { - /** - * @param Schema $schema - */ public function up(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); @@ -34,9 +31,6 @@ class Version20190601125843 extends WallabagMigration $entryTable->addIndex(['user_id', 'hashed_given_url'], 'hashed_given_url_user_id', [], ['lengths' => [null, 40]]); } - /** - * @param Schema $schema - */ public function down(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); -- cgit v1.2.3