From f808b01692a835673f328d7221ba8c212caa9b61 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Jul 2017 09:52:38 +0200 Subject: Add a real configuration for CS-Fixer --- app/AppKernel.php | 14 +++--- app/DoctrineMigrations/Version20160410190541.php | 16 +++---- app/DoctrineMigrations/Version20160812120952.php | 10 ++-- app/DoctrineMigrations/Version20160911214952.php | 22 ++++----- app/DoctrineMigrations/Version20160916201049.php | 14 +++--- app/DoctrineMigrations/Version20161001072726.php | 42 ++++++++--------- app/DoctrineMigrations/Version20161022134138.php | 60 ++++++++++++------------ app/DoctrineMigrations/Version20161024212538.php | 12 ++--- app/DoctrineMigrations/Version20161031132655.php | 16 +++---- app/DoctrineMigrations/Version20161104073720.php | 10 ++-- app/DoctrineMigrations/Version20161106113822.php | 10 ++-- app/DoctrineMigrations/Version20161117071626.php | 22 ++++----- app/DoctrineMigrations/Version20161118134328.php | 10 ++-- app/DoctrineMigrations/Version20161122144743.php | 16 +++---- app/DoctrineMigrations/Version20161122203647.php | 10 ++-- app/DoctrineMigrations/Version20161128084725.php | 10 ++-- app/DoctrineMigrations/Version20161128131503.php | 10 ++-- app/DoctrineMigrations/Version20161214094402.php | 26 +++++----- app/DoctrineMigrations/Version20161214094403.php | 10 ++-- app/DoctrineMigrations/Version20170127093841.php | 10 ++-- app/DoctrineMigrations/Version20170327194233.php | 20 ++++---- app/DoctrineMigrations/Version20170405182620.php | 10 ++-- app/DoctrineMigrations/Version20170407200919.php | 10 ++-- app/DoctrineMigrations/Version20170420134133.php | 16 +++---- app/DoctrineMigrations/Version20170501115751.php | 12 ++--- app/DoctrineMigrations/Version20170510082609.php | 14 +++--- app/DoctrineMigrations/Version20170511115400.php | 10 ++-- app/DoctrineMigrations/Version20170511211659.php | 24 ++++------ app/DoctrineMigrations/Version20170602075214.php | 16 +++---- app/DoctrineMigrations/Version20170606155640.php | 18 +++---- app/autoload.php | 6 +-- 31 files changed, 250 insertions(+), 256 deletions(-) (limited to 'app') diff --git a/app/AppKernel.php b/app/AppKernel.php index c50783a6..f1140943 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -1,7 +1,7 @@ getEnvironment(); + return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); } public function getLogDir() { - return dirname(__DIR__).'/var/logs'; + return dirname(__DIR__) . '/var/logs'; } public function registerContainerConfiguration(LoaderInterface $loader) { - $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); + $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); $loader->load(function ($container) { - if ($container->getParameter('use_webpack_dev_server')) { - $container->loadFromExtension('framework', [ + if ($container->getParameter('use_webpack_dev_server')) { + $container->loadFromExtension('framework', [ 'assets' => [ 'base_url' => 'http://localhost:8080/', ], ]); - } + } }); } } diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php index 5e5cae35..55c12ce1 100644 --- a/app/DoctrineMigrations/Version20160410190541.php +++ b/app/DoctrineMigrations/Version20160410190541.php @@ -22,11 +22,6 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -44,10 +39,10 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI $sharePublic = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_public'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_public'"); if (false === $sharePublic) { - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_public', '1', 'entry')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_public', '1', 'entry')"); } } @@ -59,6 +54,11 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI $entryTable = $schema->getTable($this->getTable('entry')); $entryTable->dropColumn('uid'); - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_public'"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_public'"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php index 13272267..677f30c3 100644 --- a/app/DoctrineMigrations/Version20160812120952.php +++ b/app/DoctrineMigrations/Version20160812120952.php @@ -22,11 +22,6 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -46,4 +41,9 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); $clientsTable->dropColumn('name'); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20160911214952.php b/app/DoctrineMigrations/Version20160911214952.php index 4eae46e7..08cc8a03 100644 --- a/app/DoctrineMigrations/Version20160911214952.php +++ b/app/DoctrineMigrations/Version20160911214952.php @@ -22,11 +22,6 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -35,19 +30,19 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI $redis = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_redis'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis'"); if (false === $redis) { - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_redis', 0, 'import')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('import_with_redis', 0, 'import')"); } $rabbitmq = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_rabbitmq'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq'"); if (false === $rabbitmq) { - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_rabbitmq', 0, 'import')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('import_with_rabbitmq', 0, 'import')"); } $this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.'); @@ -58,7 +53,12 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_redis';"); - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_rabbitmq';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq';"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php index ff34c894..83503bc4 100644 --- a/app/DoctrineMigrations/Version20160916201049.php +++ b/app/DoctrineMigrations/Version20160916201049.php @@ -22,11 +22,6 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -37,7 +32,7 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI $this->skipIf($configTable->hasColumn('pocket_consumer_key'), 'It seems that you already played this migration.'); $configTable->addColumn('pocket_consumer_key', 'string', ['notnull' => false]); - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'pocket_consumer_key';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'pocket_consumer_key';"); } /** @@ -47,6 +42,11 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI { $configTable = $schema->getTable($this->getTable('config')); $configTable->dropColumn('pocket_consumer_key'); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php index ad761541..4babe172 100644 --- a/app/DoctrineMigrations/Version20161001072726.php +++ b/app/DoctrineMigrations/Version20161001072726.php @@ -3,10 +3,10 @@ namespace Application\Migrations; use Doctrine\DBAL\Migrations\AbstractMigration; +use Doctrine\DBAL\Migrations\SkipMigrationException; use Doctrine\DBAL\Schema\Schema; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Doctrine\DBAL\Migrations\SkipMigrationException; /** * Added pocket_consumer_key field on wallabag_config. @@ -23,17 +23,12 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ public function up(Schema $schema) { - $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); + $this->skipIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); // remove all FK from entry_tag switch ($this->connection->getDatabasePlatform()->getName()) { @@ -41,16 +36,15 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI $query = $this->connection->query(" SELECT CONSTRAINT_NAME FROM information_schema.key_column_usage - WHERE TABLE_NAME = '".$this->getTable('entry_tag')."' AND CONSTRAINT_NAME LIKE 'FK_%' - AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'" + WHERE TABLE_NAME = '" . $this->getTable('entry_tag') . "' AND CONSTRAINT_NAME LIKE 'FK_%' + AND TABLE_SCHEMA = '" . $this->connection->getDatabase() . "'" ); $query->execute(); foreach ($query->fetchAll() as $fk) { - $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); + $this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' DROP FOREIGN KEY ' . $fk['CONSTRAINT_NAME']); } break; - case 'postgresql': // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk $query = $this->connection->query(" @@ -60,19 +54,19 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI FROM pg_constraint c JOIN pg_namespace n ON n.oid = c.connamespace WHERE contype = 'f' - AND conrelid::regclass::text = '".$this->getTable('entry_tag')."' + AND conrelid::regclass::text = '" . $this->getTable('entry_tag') . "' AND n.nspname = 'public';" ); $query->execute(); foreach ($query->fetchAll() as $fk) { - $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP CONSTRAINT '.$fk['conname']); + $this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' DROP CONSTRAINT ' . $fk['conname']); } break; } - $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_tag FOREIGN KEY (tag_id) REFERENCES '.$this->getTable('tag').' (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' ADD CONSTRAINT FK_entry_tag_entry FOREIGN KEY (entry_id) REFERENCES ' . $this->getTable('entry') . ' (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' ADD CONSTRAINT FK_entry_tag_tag FOREIGN KEY (tag_id) REFERENCES ' . $this->getTable('tag') . ' (id) ON DELETE CASCADE'); // remove entry FK from annotation @@ -81,18 +75,17 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI $query = $this->connection->query(" SELECT CONSTRAINT_NAME FROM information_schema.key_column_usage - WHERE TABLE_NAME = '".$this->getTable('annotation')."' + WHERE TABLE_NAME = '" . $this->getTable('annotation') . "' AND CONSTRAINT_NAME LIKE 'FK_%' AND COLUMN_NAME = 'entry_id' - AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'" + AND TABLE_SCHEMA = '" . $this->connection->getDatabase() . "'" ); $query->execute(); foreach ($query->fetchAll() as $fk) { - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' DROP FOREIGN KEY ' . $fk['CONSTRAINT_NAME']); } break; - case 'postgresql': // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk $query = $this->connection->query(" @@ -102,19 +95,19 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI FROM pg_constraint c JOIN pg_namespace n ON n.oid = c.connamespace WHERE contype = 'f' - AND conrelid::regclass::text = '".$this->getTable('annotation')."' + AND conrelid::regclass::text = '" . $this->getTable('annotation') . "' AND n.nspname = 'public' AND pg_get_constraintdef(c.oid) LIKE '%entry_id%';" ); $query->execute(); foreach ($query->fetchAll() as $fk) { - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP CONSTRAINT '.$fk['conname']); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' DROP CONSTRAINT ' . $fk['conname']); } break; } - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES ' . $this->getTable('entry') . ' (id) ON DELETE CASCADE'); } /** @@ -124,4 +117,9 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI { throw new SkipMigrationException('Too complex ...'); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php index 39949e7d..89ba9973 100644 --- a/app/DoctrineMigrations/Version20161022134138.php +++ b/app/DoctrineMigrations/Version20161022134138.php @@ -22,11 +22,6 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -34,28 +29,28 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI { $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); - $this->addSql('ALTER DATABASE '.$this->connection->getParams()['dbname'].' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); + $this->addSql('ALTER DATABASE ' . $this->connection->getParams()['dbname'] . ' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); // convert field length for utf8mb4 // http://stackoverflow.com/a/31474509/569101 - $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;'); - $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE salt salt VARCHAR(180) NOT NULL;'); - $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE password password VARCHAR(180) NOT NULL;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE salt salt VARCHAR(180) NOT NULL;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE password password VARCHAR(180) NOT NULL;'); - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `text` `text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `quote` `quote` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `title` `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `content` `content` longtext 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;'); + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); } /** @@ -65,21 +60,26 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI { $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); - $this->addSql('ALTER DATABASE '.$this->connection->getParams()['dbname'].' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;'); + $this->addSql('ALTER DATABASE ' . $this->connection->getParams()['dbname'] . ' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `text` `text` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `quote` `quote` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `title` `title` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `content` `content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php index b2f6aaf8..35853d03 100644 --- a/app/DoctrineMigrations/Version20161024212538.php +++ b/app/DoctrineMigrations/Version20161024212538.php @@ -24,11 +24,6 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -60,8 +55,13 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI $clientsTable->dropColumn('user_id', 'integer'); - if ($this->connection->getDatabasePlatform()->getName() != 'sqlite') { + if ($this->connection->getDatabasePlatform()->getName() !== 'sqlite') { $clientsTable->removeForeignKey($this->constraintName); } } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161031132655.php b/app/DoctrineMigrations/Version20161031132655.php index ef846412..0deebdf9 100644 --- a/app/DoctrineMigrations/Version20161031132655.php +++ b/app/DoctrineMigrations/Version20161031132655.php @@ -22,11 +22,6 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -35,11 +30,11 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI $images = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_images_enabled'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled'"); $this->skipIf(false !== $images, 'It seems that you already played this migration.'); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); } /** @@ -47,6 +42,11 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_images_enabled';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled';"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20161104073720.php b/app/DoctrineMigrations/Version20161104073720.php index 0e05f02e..f59ad7ba 100644 --- a/app/DoctrineMigrations/Version20161104073720.php +++ b/app/DoctrineMigrations/Version20161104073720.php @@ -24,11 +24,6 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -50,4 +45,9 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI $entryTable->dropIndex($this->indexName); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php index facc14f4..1d5a865b 100644 --- a/app/DoctrineMigrations/Version20161106113822.php +++ b/app/DoctrineMigrations/Version20161106113822.php @@ -22,11 +22,6 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -53,4 +48,9 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI $configTable->dropColumn('action_mark_as_read'); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161117071626.php b/app/DoctrineMigrations/Version20161117071626.php index e779eacf..0b34caab 100644 --- a/app/DoctrineMigrations/Version20161117071626.php +++ b/app/DoctrineMigrations/Version20161117071626.php @@ -22,11 +22,6 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -35,19 +30,19 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI $share = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_unmark'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark'"); if (false === $share) { - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_unmark', 0, 'entry')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_unmark', 0, 'entry')"); } $unmark = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'unmark_url'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url'"); if (false === $unmark) { - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')"); } $this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.'); @@ -58,7 +53,12 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_unmark';"); - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'unmark_url';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url';"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20161118134328.php b/app/DoctrineMigrations/Version20161118134328.php index 7b2eeb7b..dab0ff5b 100644 --- a/app/DoctrineMigrations/Version20161118134328.php +++ b/app/DoctrineMigrations/Version20161118134328.php @@ -22,11 +22,6 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -53,4 +48,9 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI $entryTable->dropColumn('http_status'); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161122144743.php b/app/DoctrineMigrations/Version20161122144743.php index 388a0e4b..15052ad7 100644 --- a/app/DoctrineMigrations/Version20161122144743.php +++ b/app/DoctrineMigrations/Version20161122144743.php @@ -22,11 +22,6 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -35,11 +30,11 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI $access = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'restricted_access'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access'"); $this->skipIf(false !== $access, 'It seems that you already played this migration.'); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('restricted_access', 0, 'entry')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')"); } /** @@ -47,6 +42,11 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'restricted_access';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access';"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20161122203647.php b/app/DoctrineMigrations/Version20161122203647.php index 9b17d6ef..ef08bd59 100644 --- a/app/DoctrineMigrations/Version20161122203647.php +++ b/app/DoctrineMigrations/Version20161122203647.php @@ -30,11 +30,6 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -60,4 +55,9 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI $userTable->addColumn('expired', 'smallint', ['notnull' => false]); $userTable->addColumn('credentials_expired', 'smallint', ['notnull' => false]); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161128084725.php b/app/DoctrineMigrations/Version20161128084725.php index ea370076..497a9f21 100644 --- a/app/DoctrineMigrations/Version20161128084725.php +++ b/app/DoctrineMigrations/Version20161128084725.php @@ -22,11 +22,6 @@ class Version20161128084725 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -46,4 +41,9 @@ class Version20161128084725 extends AbstractMigration implements ContainerAwareI $configTable = $schema->getTable($this->getTable('config')); $configTable->dropColumn('list_mode'); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161128131503.php b/app/DoctrineMigrations/Version20161128131503.php index b71aa38b..9d92983a 100644 --- a/app/DoctrineMigrations/Version20161128131503.php +++ b/app/DoctrineMigrations/Version20161128131503.php @@ -28,11 +28,6 @@ class Version20161128131503 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -58,4 +53,9 @@ class Version20161128131503 extends AbstractMigration implements ContainerAwareI $userTable->addColumn($field, $type, ['notnull' => false]); } } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161214094402.php b/app/DoctrineMigrations/Version20161214094402.php index 8ca32b09..07090b2f 100644 --- a/app/DoctrineMigrations/Version20161214094402.php +++ b/app/DoctrineMigrations/Version20161214094402.php @@ -22,11 +22,6 @@ class Version20161214094402 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -38,17 +33,17 @@ class Version20161214094402 extends AbstractMigration implements ContainerAwareI switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite': - $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM '.$this->getTable('entry')); - $this->addSql('DROP TABLE '.$this->getTable('entry')); - $this->addSql('CREATE TABLE '.$this->getTable('entry').' (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid CLOB DEFAULT NULL COLLATE BINARY, 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, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT "0", PRIMARY KEY(id));'); - $this->addSql('INSERT INTO '.$this->getTable('entry').' (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public) SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM __temp__wallabag_entry;'); + $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM ' . $this->getTable('entry')); + $this->addSql('DROP TABLE ' . $this->getTable('entry')); + $this->addSql('CREATE TABLE ' . $this->getTable('entry') . ' (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid CLOB DEFAULT NULL COLLATE BINARY, 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, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT "0", PRIMARY KEY(id));'); + $this->addSql('INSERT INTO ' . $this->getTable('entry') . ' (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public) SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM __temp__wallabag_entry;'); $this->addSql('DROP TABLE __temp__wallabag_entry'); break; case 'mysql': - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE uuid uid VARCHAR(23)'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE uuid uid VARCHAR(23)'); break; case 'postgresql': - $this->addSql('ALTER TABLE '.$this->getTable('entry').' RENAME uuid TO uid'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' RENAME uuid TO uid'); } } @@ -66,10 +61,15 @@ class Version20161214094402 extends AbstractMigration implements ContainerAwareI throw new SkipMigrationException('Too complex ...'); break; case 'mysql': - $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE uid uuid VARCHAR(23)'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE uid uuid VARCHAR(23)'); break; case 'postgresql': - $this->addSql('ALTER TABLE '.$this->getTable('entry').' RENAME uid TO uuid'); + $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' RENAME uid TO uuid'); } } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20161214094403.php b/app/DoctrineMigrations/Version20161214094403.php index c7326f95..6b5640e5 100644 --- a/app/DoctrineMigrations/Version20161214094403.php +++ b/app/DoctrineMigrations/Version20161214094403.php @@ -24,11 +24,6 @@ class Version20161214094403 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -50,4 +45,9 @@ class Version20161214094403 extends AbstractMigration implements ContainerAwareI $entryTable->dropIndex($this->indexName); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170127093841.php b/app/DoctrineMigrations/Version20170127093841.php index 5bfd9670..fc78a246 100644 --- a/app/DoctrineMigrations/Version20170127093841.php +++ b/app/DoctrineMigrations/Version20170127093841.php @@ -25,11 +25,6 @@ class Version20170127093841 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -53,4 +48,9 @@ class Version20170127093841 extends AbstractMigration implements ContainerAwareI $entryTable->dropIndex($this->indexStarredName); $entryTable->dropIndex($this->indexArchivedName); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170327194233.php b/app/DoctrineMigrations/Version20170327194233.php index e1466b2f..3e7e722d 100644 --- a/app/DoctrineMigrations/Version20170327194233.php +++ b/app/DoctrineMigrations/Version20170327194233.php @@ -22,11 +22,6 @@ class Version20170327194233 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -35,12 +30,12 @@ class Version20170327194233 extends AbstractMigration implements ContainerAwareI $scuttle = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_scuttle'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle'"); $this->skipIf(false !== $scuttle, 'It seems that you already played this migration.'); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_scuttle', '1', 'entry')"); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_scuttle', '1', 'entry')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); } /** @@ -48,7 +43,12 @@ class Version20170327194233 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_scuttle';"); - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'scuttle_url';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'scuttle_url';"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20170405182620.php b/app/DoctrineMigrations/Version20170405182620.php index 3ef9633f..75793fcb 100644 --- a/app/DoctrineMigrations/Version20170405182620.php +++ b/app/DoctrineMigrations/Version20170405182620.php @@ -22,11 +22,6 @@ class Version20170405182620 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -62,4 +57,9 @@ class Version20170405182620 extends AbstractMigration implements ContainerAwareI $entryTable->dropColumn('published_by'); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170407200919.php b/app/DoctrineMigrations/Version20170407200919.php index 4b9d475a..8a11ffe3 100644 --- a/app/DoctrineMigrations/Version20170407200919.php +++ b/app/DoctrineMigrations/Version20170407200919.php @@ -22,11 +22,6 @@ class Version20170407200919 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -48,4 +43,9 @@ class Version20170407200919 extends AbstractMigration implements ContainerAwareI $entryTable->addColumn('is_public', 'boolean', ['notnull' => false, 'default' => 0]); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170420134133.php b/app/DoctrineMigrations/Version20170420134133.php index b1ab7bcb..e1947a49 100644 --- a/app/DoctrineMigrations/Version20170420134133.php +++ b/app/DoctrineMigrations/Version20170420134133.php @@ -22,17 +22,12 @@ class Version20170420134133 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ public function up(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures';"); } /** @@ -43,10 +38,15 @@ class Version20170420134133 extends AbstractMigration implements ContainerAwareI $downloadPictures = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures'"); $this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.'); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_pictures', '1', 'entry')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_pictures', '1', 'entry')"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20170501115751.php b/app/DoctrineMigrations/Version20170501115751.php index 7f068eb8..adf2f841 100644 --- a/app/DoctrineMigrations/Version20170501115751.php +++ b/app/DoctrineMigrations/Version20170501115751.php @@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Add site credential table to store username & password for some website (behind authentication or paywall) + * Add site credential table to store username & password for some website (behind authentication or paywall). */ class Version20170501115751 extends AbstractMigration implements ContainerAwareInterface { @@ -22,11 +22,6 @@ class Version20170501115751 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -58,4 +53,9 @@ class Version20170501115751 extends AbstractMigration implements ContainerAwareI { $schema->dropTable($this->getTable('site_credential')); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170510082609.php b/app/DoctrineMigrations/Version20170510082609.php index a99af2d2..329613b1 100644 --- a/app/DoctrineMigrations/Version20170510082609.php +++ b/app/DoctrineMigrations/Version20170510082609.php @@ -29,11 +29,6 @@ class Version20170510082609 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -42,7 +37,7 @@ class Version20170510082609 extends AbstractMigration implements ContainerAwareI $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); foreach ($this->fields as $field) { - $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(180) NOT NULL;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(180) NOT NULL;'); } } @@ -54,7 +49,12 @@ class Version20170510082609 extends AbstractMigration implements ContainerAwareI $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); foreach ($this->fields as $field) { - $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(255) NOT NULL;'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(255) NOT NULL;'); } } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170511115400.php b/app/DoctrineMigrations/Version20170511115400.php index 64ee9e0a..cad2b637 100644 --- a/app/DoctrineMigrations/Version20170511115400.php +++ b/app/DoctrineMigrations/Version20170511115400.php @@ -22,11 +22,6 @@ class Version20170511115400 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -52,4 +47,9 @@ class Version20170511115400 extends AbstractMigration implements ContainerAwareI $entryTable->dropColumn('headers'); } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170511211659.php b/app/DoctrineMigrations/Version20170511211659.php index f2d5cf5e..f004d1b3 100644 --- a/app/DoctrineMigrations/Version20170511211659.php +++ b/app/DoctrineMigrations/Version20170511211659.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Increase the length of the "quote" column of "annotation" table + * Increase the length of the "quote" column of "annotation" table. */ class Version20170511211659 extends AbstractMigration implements ContainerAwareInterface { @@ -23,11 +23,6 @@ class Version20170511211659 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix') . $tableName; - } - public function up(Schema $schema) { $tableName = $this->getTable('annotation'); @@ -68,13 +63,11 @@ EOD ); $this->addSql('DROP TABLE __temp__wallabag_annotation'); break; - case 'mysql': - $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote TEXT NOT NULL'); + $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote TEXT NOT NULL'); break; - case 'postgresql': - $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE TEXT'); + $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE TEXT'); break; } } @@ -87,14 +80,17 @@ EOD case 'sqlite': throw new SkipMigrationException('Too complex ...'); break; - case 'mysql': - $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote VARCHAR(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote VARCHAR(255) NOT NULL'); break; - case 'postgresql': - $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE VARCHAR(255)'); + $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE VARCHAR(255)'); break; } } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } } diff --git a/app/DoctrineMigrations/Version20170602075214.php b/app/DoctrineMigrations/Version20170602075214.php index 451d16ba..6b6f0035 100644 --- a/app/DoctrineMigrations/Version20170602075214.php +++ b/app/DoctrineMigrations/Version20170602075214.php @@ -22,11 +22,6 @@ class Version20170602075214 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -35,11 +30,11 @@ class Version20170602075214 extends AbstractMigration implements ContainerAwareI $apiUserRegistration = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration'"); $this->skipIf(false !== $apiUserRegistration, 'It seems that you already played this migration.'); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('api_user_registration', '0', 'api')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')"); } /** @@ -47,6 +42,11 @@ class Version20170602075214 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration';"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/DoctrineMigrations/Version20170606155640.php b/app/DoctrineMigrations/Version20170606155640.php index e9b50428..5f58fc29 100644 --- a/app/DoctrineMigrations/Version20170606155640.php +++ b/app/DoctrineMigrations/Version20170606155640.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** * Remove wallabag_url from craue_config_setting. - * It has been moved into the parameters.yml + * It has been moved into the parameters.yml. */ class Version20170606155640 extends AbstractMigration implements ContainerAwareInterface { @@ -23,11 +23,6 @@ class Version20170606155640 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -36,11 +31,11 @@ class Version20170606155640 extends AbstractMigration implements ContainerAwareI $apiUserRegistration = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'"); $this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.'); - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'"); } /** @@ -48,6 +43,11 @@ class Version20170606155640 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')"); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } } diff --git a/app/autoload.php b/app/autoload.php index fa582ecd..c5f664dc 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -1,12 +1,12 @@