diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
commit | f808b01692a835673f328d7221ba8c212caa9b61 (patch) | |
tree | 0c3b1fc5b1ddbd7af72227303503177689e1d403 /app/DoctrineMigrations | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
download | wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.gz wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.zst wallabag-f808b01692a835673f328d7221ba8c212caa9b61.zip |
Add a real configuration for CS-Fixer
Diffstat (limited to 'app/DoctrineMigrations')
29 files changed, 240 insertions, 246 deletions
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -44,10 +39,10 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI | |||
44 | $sharePublic = $this->container | 39 | $sharePublic = $this->container |
45 | ->get('doctrine.orm.default_entity_manager') | 40 | ->get('doctrine.orm.default_entity_manager') |
46 | ->getConnection() | 41 | ->getConnection() |
47 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_public'"); | 42 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_public'"); |
48 | 43 | ||
49 | if (false === $sharePublic) { | 44 | if (false === $sharePublic) { |
50 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_public', '1', 'entry')"); | 45 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_public', '1', 'entry')"); |
51 | } | 46 | } |
52 | } | 47 | } |
53 | 48 | ||
@@ -59,6 +54,11 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI | |||
59 | $entryTable = $schema->getTable($this->getTable('entry')); | 54 | $entryTable = $schema->getTable($this->getTable('entry')); |
60 | $entryTable->dropColumn('uid'); | 55 | $entryTable->dropColumn('uid'); |
61 | 56 | ||
62 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_public'"); | 57 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_public'"); |
58 | } | ||
59 | |||
60 | private function getTable($tableName) | ||
61 | { | ||
62 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
63 | } | 63 | } |
64 | } | 64 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -46,4 +41,9 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI | |||
46 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); | 41 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); |
47 | $clientsTable->dropColumn('name'); | 42 | $clientsTable->dropColumn('name'); |
48 | } | 43 | } |
44 | |||
45 | private function getTable($tableName) | ||
46 | { | ||
47 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
48 | } | ||
49 | } | 49 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -35,19 +30,19 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI | |||
35 | $redis = $this->container | 30 | $redis = $this->container |
36 | ->get('doctrine.orm.default_entity_manager') | 31 | ->get('doctrine.orm.default_entity_manager') |
37 | ->getConnection() | 32 | ->getConnection() |
38 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_redis'"); | 33 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis'"); |
39 | 34 | ||
40 | if (false === $redis) { | 35 | if (false === $redis) { |
41 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_redis', 0, 'import')"); | 36 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('import_with_redis', 0, 'import')"); |
42 | } | 37 | } |
43 | 38 | ||
44 | $rabbitmq = $this->container | 39 | $rabbitmq = $this->container |
45 | ->get('doctrine.orm.default_entity_manager') | 40 | ->get('doctrine.orm.default_entity_manager') |
46 | ->getConnection() | 41 | ->getConnection() |
47 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_rabbitmq'"); | 42 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq'"); |
48 | 43 | ||
49 | if (false === $rabbitmq) { | 44 | if (false === $rabbitmq) { |
50 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_rabbitmq', 0, 'import')"); | 45 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('import_with_rabbitmq', 0, 'import')"); |
51 | } | 46 | } |
52 | 47 | ||
53 | $this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.'); | 48 | $this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.'); |
@@ -58,7 +53,12 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI | |||
58 | */ | 53 | */ |
59 | public function down(Schema $schema) | 54 | public function down(Schema $schema) |
60 | { | 55 | { |
61 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_redis';"); | 56 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis';"); |
62 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'import_with_rabbitmq';"); | 57 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq';"); |
58 | } | ||
59 | |||
60 | private function getTable($tableName) | ||
61 | { | ||
62 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
63 | } | 63 | } |
64 | } | 64 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -37,7 +32,7 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI | |||
37 | $this->skipIf($configTable->hasColumn('pocket_consumer_key'), 'It seems that you already played this migration.'); | 32 | $this->skipIf($configTable->hasColumn('pocket_consumer_key'), 'It seems that you already played this migration.'); |
38 | 33 | ||
39 | $configTable->addColumn('pocket_consumer_key', 'string', ['notnull' => false]); | 34 | $configTable->addColumn('pocket_consumer_key', 'string', ['notnull' => false]); |
40 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'pocket_consumer_key';"); | 35 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'pocket_consumer_key';"); |
41 | } | 36 | } |
42 | 37 | ||
43 | /** | 38 | /** |
@@ -47,6 +42,11 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI | |||
47 | { | 42 | { |
48 | $configTable = $schema->getTable($this->getTable('config')); | 43 | $configTable = $schema->getTable($this->getTable('config')); |
49 | $configTable->dropColumn('pocket_consumer_key'); | 44 | $configTable->dropColumn('pocket_consumer_key'); |
50 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')"); | 45 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')"); |
46 | } | ||
47 | |||
48 | private function getTable($tableName) | ||
49 | { | ||
50 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
51 | } | 51 | } |
52 | } | 52 | } |
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 @@ | |||
3 | namespace Application\Migrations; | 3 | namespace Application\Migrations; |
4 | 4 | ||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | 5 | use Doctrine\DBAL\Migrations\AbstractMigration; |
6 | use Doctrine\DBAL\Migrations\SkipMigrationException; | ||
6 | use Doctrine\DBAL\Schema\Schema; | 7 | use Doctrine\DBAL\Schema\Schema; |
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; |
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 9 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | use Doctrine\DBAL\Migrations\SkipMigrationException; | ||
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Added pocket_consumer_key field on wallabag_config. | 12 | * Added pocket_consumer_key field on wallabag_config. |
@@ -23,17 +23,12 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI | |||
23 | $this->container = $container; | 23 | $this->container = $container; |
24 | } | 24 | } |
25 | 25 | ||
26 | private function getTable($tableName) | ||
27 | { | ||
28 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
29 | } | ||
30 | |||
31 | /** | 26 | /** |
32 | * @param Schema $schema | 27 | * @param Schema $schema |
33 | */ | 28 | */ |
34 | public function up(Schema $schema) | 29 | public function up(Schema $schema) |
35 | { | 30 | { |
36 | $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); | 31 | $this->skipIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); |
37 | 32 | ||
38 | // remove all FK from entry_tag | 33 | // remove all FK from entry_tag |
39 | switch ($this->connection->getDatabasePlatform()->getName()) { | 34 | switch ($this->connection->getDatabasePlatform()->getName()) { |
@@ -41,16 +36,15 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI | |||
41 | $query = $this->connection->query(" | 36 | $query = $this->connection->query(" |
42 | SELECT CONSTRAINT_NAME | 37 | SELECT CONSTRAINT_NAME |
43 | FROM information_schema.key_column_usage | 38 | FROM information_schema.key_column_usage |
44 | WHERE TABLE_NAME = '".$this->getTable('entry_tag')."' AND CONSTRAINT_NAME LIKE 'FK_%' | 39 | WHERE TABLE_NAME = '" . $this->getTable('entry_tag') . "' AND CONSTRAINT_NAME LIKE 'FK_%' |
45 | AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'" | 40 | AND TABLE_SCHEMA = '" . $this->connection->getDatabase() . "'" |
46 | ); | 41 | ); |
47 | $query->execute(); | 42 | $query->execute(); |
48 | 43 | ||
49 | foreach ($query->fetchAll() as $fk) { | 44 | foreach ($query->fetchAll() as $fk) { |
50 | $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); | 45 | $this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' DROP FOREIGN KEY ' . $fk['CONSTRAINT_NAME']); |
51 | } | 46 | } |
52 | break; | 47 | break; |
53 | |||
54 | case 'postgresql': | 48 | case 'postgresql': |
55 | // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk | 49 | // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk |
56 | $query = $this->connection->query(" | 50 | $query = $this->connection->query(" |
@@ -60,19 +54,19 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI | |||
60 | FROM pg_constraint c | 54 | FROM pg_constraint c |
61 | JOIN pg_namespace n ON n.oid = c.connamespace | 55 | JOIN pg_namespace n ON n.oid = c.connamespace |
62 | WHERE contype = 'f' | 56 | WHERE contype = 'f' |
63 | AND conrelid::regclass::text = '".$this->getTable('entry_tag')."' | 57 | AND conrelid::regclass::text = '" . $this->getTable('entry_tag') . "' |
64 | AND n.nspname = 'public';" | 58 | AND n.nspname = 'public';" |
65 | ); | 59 | ); |
66 | $query->execute(); | 60 | $query->execute(); |
67 | 61 | ||
68 | foreach ($query->fetchAll() as $fk) { | 62 | foreach ($query->fetchAll() as $fk) { |
69 | $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP CONSTRAINT '.$fk['conname']); | 63 | $this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' DROP CONSTRAINT ' . $fk['conname']); |
70 | } | 64 | } |
71 | break; | 65 | break; |
72 | } | 66 | } |
73 | 67 | ||
74 | $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'); | 68 | $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'); |
75 | $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'); | 69 | $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'); |
76 | 70 | ||
77 | // remove entry FK from annotation | 71 | // remove entry FK from annotation |
78 | 72 | ||
@@ -81,18 +75,17 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI | |||
81 | $query = $this->connection->query(" | 75 | $query = $this->connection->query(" |
82 | SELECT CONSTRAINT_NAME | 76 | SELECT CONSTRAINT_NAME |
83 | FROM information_schema.key_column_usage | 77 | FROM information_schema.key_column_usage |
84 | WHERE TABLE_NAME = '".$this->getTable('annotation')."' | 78 | WHERE TABLE_NAME = '" . $this->getTable('annotation') . "' |
85 | AND CONSTRAINT_NAME LIKE 'FK_%' | 79 | AND CONSTRAINT_NAME LIKE 'FK_%' |
86 | AND COLUMN_NAME = 'entry_id' | 80 | AND COLUMN_NAME = 'entry_id' |
87 | AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'" | 81 | AND TABLE_SCHEMA = '" . $this->connection->getDatabase() . "'" |
88 | ); | 82 | ); |
89 | $query->execute(); | 83 | $query->execute(); |
90 | 84 | ||
91 | foreach ($query->fetchAll() as $fk) { | 85 | foreach ($query->fetchAll() as $fk) { |
92 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); | 86 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' DROP FOREIGN KEY ' . $fk['CONSTRAINT_NAME']); |
93 | } | 87 | } |
94 | break; | 88 | break; |
95 | |||
96 | case 'postgresql': | 89 | case 'postgresql': |
97 | // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk | 90 | // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk |
98 | $query = $this->connection->query(" | 91 | $query = $this->connection->query(" |
@@ -102,19 +95,19 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI | |||
102 | FROM pg_constraint c | 95 | FROM pg_constraint c |
103 | JOIN pg_namespace n ON n.oid = c.connamespace | 96 | JOIN pg_namespace n ON n.oid = c.connamespace |
104 | WHERE contype = 'f' | 97 | WHERE contype = 'f' |
105 | AND conrelid::regclass::text = '".$this->getTable('annotation')."' | 98 | AND conrelid::regclass::text = '" . $this->getTable('annotation') . "' |
106 | AND n.nspname = 'public' | 99 | AND n.nspname = 'public' |
107 | AND pg_get_constraintdef(c.oid) LIKE '%entry_id%';" | 100 | AND pg_get_constraintdef(c.oid) LIKE '%entry_id%';" |
108 | ); | 101 | ); |
109 | $query->execute(); | 102 | $query->execute(); |
110 | 103 | ||
111 | foreach ($query->fetchAll() as $fk) { | 104 | foreach ($query->fetchAll() as $fk) { |
112 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP CONSTRAINT '.$fk['conname']); | 105 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' DROP CONSTRAINT ' . $fk['conname']); |
113 | } | 106 | } |
114 | break; | 107 | break; |
115 | } | 108 | } |
116 | 109 | ||
117 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE'); | 110 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES ' . $this->getTable('entry') . ' (id) ON DELETE CASCADE'); |
118 | } | 111 | } |
119 | 112 | ||
120 | /** | 113 | /** |
@@ -124,4 +117,9 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI | |||
124 | { | 117 | { |
125 | throw new SkipMigrationException('Too complex ...'); | 118 | throw new SkipMigrationException('Too complex ...'); |
126 | } | 119 | } |
120 | |||
121 | private function getTable($tableName) | ||
122 | { | ||
123 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
124 | } | ||
127 | } | 125 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -34,28 +29,28 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI | |||
34 | { | 29 | { |
35 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); | 30 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); |
36 | 31 | ||
37 | $this->addSql('ALTER DATABASE '.$this->connection->getParams()['dbname'].' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); | 32 | $this->addSql('ALTER DATABASE ' . $this->connection->getParams()['dbname'] . ' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); |
38 | 33 | ||
39 | // convert field length for utf8mb4 | 34 | // convert field length for utf8mb4 |
40 | // http://stackoverflow.com/a/31474509/569101 | 35 | // http://stackoverflow.com/a/31474509/569101 |
41 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;'); | 36 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;'); |
42 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE salt salt VARCHAR(180) NOT NULL;'); | 37 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE salt salt VARCHAR(180) NOT NULL;'); |
43 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE password password VARCHAR(180) NOT NULL;'); | 38 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE password password VARCHAR(180) NOT NULL;'); |
44 | 39 | ||
45 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 40 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
46 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 41 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
47 | $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 42 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
48 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 43 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
49 | 44 | ||
50 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 45 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `text` `text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
51 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 46 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `quote` `quote` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
52 | 47 | ||
53 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 48 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `title` `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
54 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 49 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `content` `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
55 | 50 | ||
56 | $this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 51 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
57 | 52 | ||
58 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | 53 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); |
59 | } | 54 | } |
60 | 55 | ||
61 | /** | 56 | /** |
@@ -65,21 +60,26 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI | |||
65 | { | 60 | { |
66 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); | 61 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); |
67 | 62 | ||
68 | $this->addSql('ALTER DATABASE '.$this->connection->getParams()['dbname'].' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;'); | 63 | $this->addSql('ALTER DATABASE ' . $this->connection->getParams()['dbname'] . ' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;'); |
69 | 64 | ||
70 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 65 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
71 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 66 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
72 | $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 67 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
73 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 68 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
74 | 69 | ||
75 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 70 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `text` `text` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
76 | $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 71 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' CHANGE `quote` `quote` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
77 | 72 | ||
78 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 73 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `title` `title` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
79 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 74 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE `content` `content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
80 | 75 | ||
81 | $this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 76 | $this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
82 | 77 | ||
83 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | 78 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); |
79 | } | ||
80 | |||
81 | private function getTable($tableName) | ||
82 | { | ||
83 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
84 | } | 84 | } |
85 | } | 85 | } |
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 | |||
24 | $this->container = $container; | 24 | $this->container = $container; |
25 | } | 25 | } |
26 | 26 | ||
27 | private function getTable($tableName) | ||
28 | { | ||
29 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
30 | } | ||
31 | |||
32 | /** | 27 | /** |
33 | * @param Schema $schema | 28 | * @param Schema $schema |
34 | */ | 29 | */ |
@@ -60,8 +55,13 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI | |||
60 | 55 | ||
61 | $clientsTable->dropColumn('user_id', 'integer'); | 56 | $clientsTable->dropColumn('user_id', 'integer'); |
62 | 57 | ||
63 | if ($this->connection->getDatabasePlatform()->getName() != 'sqlite') { | 58 | if ($this->connection->getDatabasePlatform()->getName() !== 'sqlite') { |
64 | $clientsTable->removeForeignKey($this->constraintName); | 59 | $clientsTable->removeForeignKey($this->constraintName); |
65 | } | 60 | } |
66 | } | 61 | } |
62 | |||
63 | private function getTable($tableName) | ||
64 | { | ||
65 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
66 | } | ||
67 | } | 67 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -35,11 +30,11 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI | |||
35 | $images = $this->container | 30 | $images = $this->container |
36 | ->get('doctrine.orm.default_entity_manager') | 31 | ->get('doctrine.orm.default_entity_manager') |
37 | ->getConnection() | 32 | ->getConnection() |
38 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_images_enabled'"); | 33 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled'"); |
39 | 34 | ||
40 | $this->skipIf(false !== $images, 'It seems that you already played this migration.'); | 35 | $this->skipIf(false !== $images, 'It seems that you already played this migration.'); |
41 | 36 | ||
42 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); | 37 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); |
43 | } | 38 | } |
44 | 39 | ||
45 | /** | 40 | /** |
@@ -47,6 +42,11 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI | |||
47 | */ | 42 | */ |
48 | public function down(Schema $schema) | 43 | public function down(Schema $schema) |
49 | { | 44 | { |
50 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_images_enabled';"); | 45 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled';"); |
46 | } | ||
47 | |||
48 | private function getTable($tableName) | ||
49 | { | ||
50 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
51 | } | 51 | } |
52 | } | 52 | } |
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 | |||
24 | $this->container = $container; | 24 | $this->container = $container; |
25 | } | 25 | } |
26 | 26 | ||
27 | private function getTable($tableName) | ||
28 | { | ||
29 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
30 | } | ||
31 | |||
32 | /** | 27 | /** |
33 | * @param Schema $schema | 28 | * @param Schema $schema |
34 | */ | 29 | */ |
@@ -50,4 +45,9 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI | |||
50 | 45 | ||
51 | $entryTable->dropIndex($this->indexName); | 46 | $entryTable->dropIndex($this->indexName); |
52 | } | 47 | } |
48 | |||
49 | private function getTable($tableName) | ||
50 | { | ||
51 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
52 | } | ||
53 | } | 53 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -53,4 +48,9 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI | |||
53 | 48 | ||
54 | $configTable->dropColumn('action_mark_as_read'); | 49 | $configTable->dropColumn('action_mark_as_read'); |
55 | } | 50 | } |
51 | |||
52 | private function getTable($tableName) | ||
53 | { | ||
54 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
55 | } | ||
56 | } | 56 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -35,19 +30,19 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI | |||
35 | $share = $this->container | 30 | $share = $this->container |
36 | ->get('doctrine.orm.default_entity_manager') | 31 | ->get('doctrine.orm.default_entity_manager') |
37 | ->getConnection() | 32 | ->getConnection() |
38 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_unmark'"); | 33 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark'"); |
39 | 34 | ||
40 | if (false === $share) { | 35 | if (false === $share) { |
41 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_unmark', 0, 'entry')"); | 36 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_unmark', 0, 'entry')"); |
42 | } | 37 | } |
43 | 38 | ||
44 | $unmark = $this->container | 39 | $unmark = $this->container |
45 | ->get('doctrine.orm.default_entity_manager') | 40 | ->get('doctrine.orm.default_entity_manager') |
46 | ->getConnection() | 41 | ->getConnection() |
47 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'unmark_url'"); | 42 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url'"); |
48 | 43 | ||
49 | if (false === $unmark) { | 44 | if (false === $unmark) { |
50 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')"); | 45 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')"); |
51 | } | 46 | } |
52 | 47 | ||
53 | $this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.'); | 48 | $this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.'); |
@@ -58,7 +53,12 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI | |||
58 | */ | 53 | */ |
59 | public function down(Schema $schema) | 54 | public function down(Schema $schema) |
60 | { | 55 | { |
61 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_unmark';"); | 56 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark';"); |
62 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'unmark_url';"); | 57 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url';"); |
58 | } | ||
59 | |||
60 | private function getTable($tableName) | ||
61 | { | ||
62 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
63 | } | 63 | } |
64 | } | 64 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -53,4 +48,9 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI | |||
53 | 48 | ||
54 | $entryTable->dropColumn('http_status'); | 49 | $entryTable->dropColumn('http_status'); |
55 | } | 50 | } |
51 | |||
52 | private function getTable($tableName) | ||
53 | { | ||
54 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
55 | } | ||
56 | } | 56 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -35,11 +30,11 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI | |||
35 | $access = $this->container | 30 | $access = $this->container |
36 | ->get('doctrine.orm.default_entity_manager') | 31 | ->get('doctrine.orm.default_entity_manager') |
37 | ->getConnection() | 32 | ->getConnection() |
38 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'restricted_access'"); | 33 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access'"); |
39 | 34 | ||
40 | $this->skipIf(false !== $access, 'It seems that you already played this migration.'); | 35 | $this->skipIf(false !== $access, 'It seems that you already played this migration.'); |
41 | 36 | ||
42 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('restricted_access', 0, 'entry')"); | 37 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')"); |
43 | } | 38 | } |
44 | 39 | ||
45 | /** | 40 | /** |
@@ -47,6 +42,11 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI | |||
47 | */ | 42 | */ |
48 | public function down(Schema $schema) | 43 | public function down(Schema $schema) |
49 | { | 44 | { |
50 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'restricted_access';"); | 45 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access';"); |
46 | } | ||
47 | |||
48 | private function getTable($tableName) | ||
49 | { | ||
50 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
51 | } | 51 | } |
52 | } | 52 | } |
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 | |||
30 | $this->container = $container; | 30 | $this->container = $container; |
31 | } | 31 | } |
32 | 32 | ||
33 | private function getTable($tableName) | ||
34 | { | ||
35 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
36 | } | ||
37 | |||
38 | /** | 33 | /** |
39 | * @param Schema $schema | 34 | * @param Schema $schema |
40 | */ | 35 | */ |
@@ -60,4 +55,9 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI | |||
60 | $userTable->addColumn('expired', 'smallint', ['notnull' => false]); | 55 | $userTable->addColumn('expired', 'smallint', ['notnull' => false]); |
61 | $userTable->addColumn('credentials_expired', 'smallint', ['notnull' => false]); | 56 | $userTable->addColumn('credentials_expired', 'smallint', ['notnull' => false]); |
62 | } | 57 | } |
58 | |||
59 | private function getTable($tableName) | ||
60 | { | ||
61 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
62 | } | ||
63 | } | 63 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -46,4 +41,9 @@ class Version20161128084725 extends AbstractMigration implements ContainerAwareI | |||
46 | $configTable = $schema->getTable($this->getTable('config')); | 41 | $configTable = $schema->getTable($this->getTable('config')); |
47 | $configTable->dropColumn('list_mode'); | 42 | $configTable->dropColumn('list_mode'); |
48 | } | 43 | } |
44 | |||
45 | private function getTable($tableName) | ||
46 | { | ||
47 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
48 | } | ||
49 | } | 49 | } |
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 | |||
28 | $this->container = $container; | 28 | $this->container = $container; |
29 | } | 29 | } |
30 | 30 | ||
31 | private function getTable($tableName) | ||
32 | { | ||
33 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
34 | } | ||
35 | |||
36 | /** | 31 | /** |
37 | * @param Schema $schema | 32 | * @param Schema $schema |
38 | */ | 33 | */ |
@@ -58,4 +53,9 @@ class Version20161128131503 extends AbstractMigration implements ContainerAwareI | |||
58 | $userTable->addColumn($field, $type, ['notnull' => false]); | 53 | $userTable->addColumn($field, $type, ['notnull' => false]); |
59 | } | 54 | } |
60 | } | 55 | } |
56 | |||
57 | private function getTable($tableName) | ||
58 | { | ||
59 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
60 | } | ||
61 | } | 61 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -38,17 +33,17 @@ class Version20161214094402 extends AbstractMigration implements ContainerAwareI | |||
38 | 33 | ||
39 | switch ($this->connection->getDatabasePlatform()->getName()) { | 34 | switch ($this->connection->getDatabasePlatform()->getName()) { |
40 | case 'sqlite': | 35 | case 'sqlite': |
41 | $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')); | 36 | $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')); |
42 | $this->addSql('DROP TABLE '.$this->getTable('entry')); | 37 | $this->addSql('DROP TABLE ' . $this->getTable('entry')); |
43 | $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));'); | 38 | $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));'); |
44 | $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;'); | 39 | $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;'); |
45 | $this->addSql('DROP TABLE __temp__wallabag_entry'); | 40 | $this->addSql('DROP TABLE __temp__wallabag_entry'); |
46 | break; | 41 | break; |
47 | case 'mysql': | 42 | case 'mysql': |
48 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE uuid uid VARCHAR(23)'); | 43 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE uuid uid VARCHAR(23)'); |
49 | break; | 44 | break; |
50 | case 'postgresql': | 45 | case 'postgresql': |
51 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' RENAME uuid TO uid'); | 46 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' RENAME uuid TO uid'); |
52 | } | 47 | } |
53 | } | 48 | } |
54 | 49 | ||
@@ -66,10 +61,15 @@ class Version20161214094402 extends AbstractMigration implements ContainerAwareI | |||
66 | throw new SkipMigrationException('Too complex ...'); | 61 | throw new SkipMigrationException('Too complex ...'); |
67 | break; | 62 | break; |
68 | case 'mysql': | 63 | case 'mysql': |
69 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE uid uuid VARCHAR(23)'); | 64 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE uid uuid VARCHAR(23)'); |
70 | break; | 65 | break; |
71 | case 'postgresql': | 66 | case 'postgresql': |
72 | $this->addSql('ALTER TABLE '.$this->getTable('entry').' RENAME uid TO uuid'); | 67 | $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' RENAME uid TO uuid'); |
73 | } | 68 | } |
74 | } | 69 | } |
70 | |||
71 | private function getTable($tableName) | ||
72 | { | ||
73 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
74 | } | ||
75 | } | 75 | } |
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 | |||
24 | $this->container = $container; | 24 | $this->container = $container; |
25 | } | 25 | } |
26 | 26 | ||
27 | private function getTable($tableName) | ||
28 | { | ||
29 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
30 | } | ||
31 | |||
32 | /** | 27 | /** |
33 | * @param Schema $schema | 28 | * @param Schema $schema |
34 | */ | 29 | */ |
@@ -50,4 +45,9 @@ class Version20161214094403 extends AbstractMigration implements ContainerAwareI | |||
50 | 45 | ||
51 | $entryTable->dropIndex($this->indexName); | 46 | $entryTable->dropIndex($this->indexName); |
52 | } | 47 | } |
48 | |||
49 | private function getTable($tableName) | ||
50 | { | ||
51 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
52 | } | ||
53 | } | 53 | } |
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 | |||
25 | $this->container = $container; | 25 | $this->container = $container; |
26 | } | 26 | } |
27 | 27 | ||
28 | private function getTable($tableName) | ||
29 | { | ||
30 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
31 | } | ||
32 | |||
33 | /** | 28 | /** |
34 | * @param Schema $schema | 29 | * @param Schema $schema |
35 | */ | 30 | */ |
@@ -53,4 +48,9 @@ class Version20170127093841 extends AbstractMigration implements ContainerAwareI | |||
53 | $entryTable->dropIndex($this->indexStarredName); | 48 | $entryTable->dropIndex($this->indexStarredName); |
54 | $entryTable->dropIndex($this->indexArchivedName); | 49 | $entryTable->dropIndex($this->indexArchivedName); |
55 | } | 50 | } |
51 | |||
52 | private function getTable($tableName) | ||
53 | { | ||
54 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
55 | } | ||
56 | } | 56 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -35,12 +30,12 @@ class Version20170327194233 extends AbstractMigration implements ContainerAwareI | |||
35 | $scuttle = $this->container | 30 | $scuttle = $this->container |
36 | ->get('doctrine.orm.default_entity_manager') | 31 | ->get('doctrine.orm.default_entity_manager') |
37 | ->getConnection() | 32 | ->getConnection() |
38 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_scuttle'"); | 33 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle'"); |
39 | 34 | ||
40 | $this->skipIf(false !== $scuttle, 'It seems that you already played this migration.'); | 35 | $this->skipIf(false !== $scuttle, 'It seems that you already played this migration.'); |
41 | 36 | ||
42 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_scuttle', '1', 'entry')"); | 37 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_scuttle', '1', 'entry')"); |
43 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); | 38 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')"); |
44 | } | 39 | } |
45 | 40 | ||
46 | /** | 41 | /** |
@@ -48,7 +43,12 @@ class Version20170327194233 extends AbstractMigration implements ContainerAwareI | |||
48 | */ | 43 | */ |
49 | public function down(Schema $schema) | 44 | public function down(Schema $schema) |
50 | { | 45 | { |
51 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_scuttle';"); | 46 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle';"); |
52 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'scuttle_url';"); | 47 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'scuttle_url';"); |
48 | } | ||
49 | |||
50 | private function getTable($tableName) | ||
51 | { | ||
52 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
53 | } | 53 | } |
54 | } | 54 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -62,4 +57,9 @@ class Version20170405182620 extends AbstractMigration implements ContainerAwareI | |||
62 | 57 | ||
63 | $entryTable->dropColumn('published_by'); | 58 | $entryTable->dropColumn('published_by'); |
64 | } | 59 | } |
60 | |||
61 | private function getTable($tableName) | ||
62 | { | ||
63 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
64 | } | ||
65 | } | 65 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -48,4 +43,9 @@ class Version20170407200919 extends AbstractMigration implements ContainerAwareI | |||
48 | 43 | ||
49 | $entryTable->addColumn('is_public', 'boolean', ['notnull' => false, 'default' => 0]); | 44 | $entryTable->addColumn('is_public', 'boolean', ['notnull' => false, 'default' => 0]); |
50 | } | 45 | } |
46 | |||
47 | private function getTable($tableName) | ||
48 | { | ||
49 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
50 | } | ||
51 | } | 51 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
33 | public function up(Schema $schema) | 28 | public function up(Schema $schema) |
34 | { | 29 | { |
35 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures';"); | 30 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures';"); |
36 | } | 31 | } |
37 | 32 | ||
38 | /** | 33 | /** |
@@ -43,10 +38,15 @@ class Version20170420134133 extends AbstractMigration implements ContainerAwareI | |||
43 | $downloadPictures = $this->container | 38 | $downloadPictures = $this->container |
44 | ->get('doctrine.orm.default_entity_manager') | 39 | ->get('doctrine.orm.default_entity_manager') |
45 | ->getConnection() | 40 | ->getConnection() |
46 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures'"); | 41 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures'"); |
47 | 42 | ||
48 | $this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.'); | 43 | $this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.'); |
49 | 44 | ||
50 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_pictures', '1', 'entry')"); | 45 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_pictures', '1', 'entry')"); |
46 | } | ||
47 | |||
48 | private function getTable($tableName) | ||
49 | { | ||
50 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
51 | } | 51 | } |
52 | } | 52 | } |
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; | |||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | 8 | use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Add site credential table to store username & password for some website (behind authentication or paywall) | 11 | * Add site credential table to store username & password for some website (behind authentication or paywall). |
12 | */ | 12 | */ |
13 | class Version20170501115751 extends AbstractMigration implements ContainerAwareInterface | 13 | class Version20170501115751 extends AbstractMigration implements ContainerAwareInterface |
14 | { | 14 | { |
@@ -22,11 +22,6 @@ class Version20170501115751 extends AbstractMigration implements ContainerAwareI | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -58,4 +53,9 @@ class Version20170501115751 extends AbstractMigration implements ContainerAwareI | |||
58 | { | 53 | { |
59 | $schema->dropTable($this->getTable('site_credential')); | 54 | $schema->dropTable($this->getTable('site_credential')); |
60 | } | 55 | } |
56 | |||
57 | private function getTable($tableName) | ||
58 | { | ||
59 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
60 | } | ||
61 | } | 61 | } |
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 | |||
29 | $this->container = $container; | 29 | $this->container = $container; |
30 | } | 30 | } |
31 | 31 | ||
32 | private function getTable($tableName) | ||
33 | { | ||
34 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
35 | } | ||
36 | |||
37 | /** | 32 | /** |
38 | * @param Schema $schema | 33 | * @param Schema $schema |
39 | */ | 34 | */ |
@@ -42,7 +37,7 @@ class Version20170510082609 extends AbstractMigration implements ContainerAwareI | |||
42 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); | 37 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); |
43 | 38 | ||
44 | foreach ($this->fields as $field) { | 39 | foreach ($this->fields as $field) { |
45 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(180) NOT NULL;'); | 40 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(180) NOT NULL;'); |
46 | } | 41 | } |
47 | } | 42 | } |
48 | 43 | ||
@@ -54,7 +49,12 @@ class Version20170510082609 extends AbstractMigration implements ContainerAwareI | |||
54 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); | 49 | $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); |
55 | 50 | ||
56 | foreach ($this->fields as $field) { | 51 | foreach ($this->fields as $field) { |
57 | $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(255) NOT NULL;'); | 52 | $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(255) NOT NULL;'); |
58 | } | 53 | } |
59 | } | 54 | } |
55 | |||
56 | private function getTable($tableName) | ||
57 | { | ||
58 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
59 | } | ||
60 | } | 60 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -52,4 +47,9 @@ class Version20170511115400 extends AbstractMigration implements ContainerAwareI | |||
52 | 47 | ||
53 | $entryTable->dropColumn('headers'); | 48 | $entryTable->dropColumn('headers'); |
54 | } | 49 | } |
50 | |||
51 | private function getTable($tableName) | ||
52 | { | ||
53 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
54 | } | ||
55 | } | 55 | } |
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; | |||
9 | use Symfony\Component\DependencyInjection\ContainerInterface; | 9 | use Symfony\Component\DependencyInjection\ContainerInterface; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Increase the length of the "quote" column of "annotation" table | 12 | * Increase the length of the "quote" column of "annotation" table. |
13 | */ | 13 | */ |
14 | class Version20170511211659 extends AbstractMigration implements ContainerAwareInterface | 14 | class Version20170511211659 extends AbstractMigration implements ContainerAwareInterface |
15 | { | 15 | { |
@@ -23,11 +23,6 @@ class Version20170511211659 extends AbstractMigration implements ContainerAwareI | |||
23 | $this->container = $container; | 23 | $this->container = $container; |
24 | } | 24 | } |
25 | 25 | ||
26 | private function getTable($tableName) | ||
27 | { | ||
28 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
29 | } | ||
30 | |||
31 | public function up(Schema $schema) | 26 | public function up(Schema $schema) |
32 | { | 27 | { |
33 | $tableName = $this->getTable('annotation'); | 28 | $tableName = $this->getTable('annotation'); |
@@ -68,13 +63,11 @@ EOD | |||
68 | ); | 63 | ); |
69 | $this->addSql('DROP TABLE __temp__wallabag_annotation'); | 64 | $this->addSql('DROP TABLE __temp__wallabag_annotation'); |
70 | break; | 65 | break; |
71 | |||
72 | case 'mysql': | 66 | case 'mysql': |
73 | $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote TEXT NOT NULL'); | 67 | $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote TEXT NOT NULL'); |
74 | break; | 68 | break; |
75 | |||
76 | case 'postgresql': | 69 | case 'postgresql': |
77 | $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE TEXT'); | 70 | $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE TEXT'); |
78 | break; | 71 | break; |
79 | } | 72 | } |
80 | } | 73 | } |
@@ -87,14 +80,17 @@ EOD | |||
87 | case 'sqlite': | 80 | case 'sqlite': |
88 | throw new SkipMigrationException('Too complex ...'); | 81 | throw new SkipMigrationException('Too complex ...'); |
89 | break; | 82 | break; |
90 | |||
91 | case 'mysql': | 83 | case 'mysql': |
92 | $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote VARCHAR(255) NOT NULL'); | 84 | $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote VARCHAR(255) NOT NULL'); |
93 | break; | 85 | break; |
94 | |||
95 | case 'postgresql': | 86 | case 'postgresql': |
96 | $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE VARCHAR(255)'); | 87 | $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE VARCHAR(255)'); |
97 | break; | 88 | break; |
98 | } | 89 | } |
99 | } | 90 | } |
91 | |||
92 | private function getTable($tableName) | ||
93 | { | ||
94 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
95 | } | ||
100 | } | 96 | } |
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 | |||
22 | $this->container = $container; | 22 | $this->container = $container; |
23 | } | 23 | } |
24 | 24 | ||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * @param Schema $schema | 26 | * @param Schema $schema |
32 | */ | 27 | */ |
@@ -35,11 +30,11 @@ class Version20170602075214 extends AbstractMigration implements ContainerAwareI | |||
35 | $apiUserRegistration = $this->container | 30 | $apiUserRegistration = $this->container |
36 | ->get('doctrine.orm.default_entity_manager') | 31 | ->get('doctrine.orm.default_entity_manager') |
37 | ->getConnection() | 32 | ->getConnection() |
38 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration'"); | 33 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration'"); |
39 | 34 | ||
40 | $this->skipIf(false !== $apiUserRegistration, 'It seems that you already played this migration.'); | 35 | $this->skipIf(false !== $apiUserRegistration, 'It seems that you already played this migration.'); |
41 | 36 | ||
42 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('api_user_registration', '0', 'api')"); | 37 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')"); |
43 | } | 38 | } |
44 | 39 | ||
45 | /** | 40 | /** |
@@ -47,6 +42,11 @@ class Version20170602075214 extends AbstractMigration implements ContainerAwareI | |||
47 | */ | 42 | */ |
48 | public function down(Schema $schema) | 43 | public function down(Schema $schema) |
49 | { | 44 | { |
50 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration';"); | 45 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration';"); |
46 | } | ||
47 | |||
48 | private function getTable($tableName) | ||
49 | { | ||
50 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
51 | } | 51 | } |
52 | } | 52 | } |
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; | |||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Remove wallabag_url from craue_config_setting. | 11 | * Remove wallabag_url from craue_config_setting. |
12 | * It has been moved into the parameters.yml | 12 | * It has been moved into the parameters.yml. |
13 | */ | 13 | */ |
14 | class Version20170606155640 extends AbstractMigration implements ContainerAwareInterface | 14 | class Version20170606155640 extends AbstractMigration implements ContainerAwareInterface |
15 | { | 15 | { |
@@ -23,11 +23,6 @@ class Version20170606155640 extends AbstractMigration implements ContainerAwareI | |||
23 | $this->container = $container; | 23 | $this->container = $container; |
24 | } | 24 | } |
25 | 25 | ||
26 | private function getTable($tableName) | ||
27 | { | ||
28 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
29 | } | ||
30 | |||
31 | /** | 26 | /** |
32 | * @param Schema $schema | 27 | * @param Schema $schema |
33 | */ | 28 | */ |
@@ -36,11 +31,11 @@ class Version20170606155640 extends AbstractMigration implements ContainerAwareI | |||
36 | $apiUserRegistration = $this->container | 31 | $apiUserRegistration = $this->container |
37 | ->get('doctrine.orm.default_entity_manager') | 32 | ->get('doctrine.orm.default_entity_manager') |
38 | ->getConnection() | 33 | ->getConnection() |
39 | ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'"); | 34 | ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'"); |
40 | 35 | ||
41 | $this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.'); | 36 | $this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.'); |
42 | 37 | ||
43 | $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'"); | 38 | $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'"); |
44 | } | 39 | } |
45 | 40 | ||
46 | /** | 41 | /** |
@@ -48,6 +43,11 @@ class Version20170606155640 extends AbstractMigration implements ContainerAwareI | |||
48 | */ | 43 | */ |
49 | public function down(Schema $schema) | 44 | public function down(Schema $schema) |
50 | { | 45 | { |
51 | $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')"); | 46 | $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')"); |
47 | } | ||
48 | |||
49 | private function getTable($tableName) | ||
50 | { | ||
51 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
52 | } | 52 | } |
53 | } | 53 | } |