aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-10-24 11:57:51 +0200
committerGitHub <noreply@github.com>2016-10-24 11:57:51 +0200
commit9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5 (patch)
tree659842576e853a536c67e7c74139a73853b6caf2 /app
parenta1c18418288a9521c980c96fd5defffc757a81c6 (diff)
parentf623516e107c8146f87d815f033cecb5d812466a (diff)
downloadwallabag-9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5.tar.gz
wallabag-9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5.tar.zst
wallabag-9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5.zip
Merge pull request #2401 from wallabag/reset-account
Reset account
Diffstat (limited to 'app')
-rw-r--r--app/DoctrineMigrations/Version20160410190541.php12
-rw-r--r--app/DoctrineMigrations/Version20160812120952.php15
-rw-r--r--app/DoctrineMigrations/Version20160911214952.php4
-rw-r--r--app/DoctrineMigrations/Version20160916201049.php6
-rw-r--r--app/DoctrineMigrations/Version20161001072726.php63
-rw-r--r--app/DoctrineMigrations/Version20161022134138.php77
-rw-r--r--app/config/config.yml2
-rw-r--r--app/config/config_test.yml2
-rw-r--r--app/config/parameters.yml.dist14
-rw-r--r--app/config/parameters_test.yml1
-rw-r--r--app/config/tests/parameters_test.mysql.yml1
-rw-r--r--app/config/tests/parameters_test.pgsql.yml1
-rw-r--r--app/config/tests/parameters_test.sqlite.yml1
13 files changed, 178 insertions, 21 deletions
diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php
index 4014857b..c41b0465 100644
--- a/app/DoctrineMigrations/Version20160410190541.php
+++ b/app/DoctrineMigrations/Version20160410190541.php
@@ -29,8 +29,12 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI
29 */ 29 */
30 public function up(Schema $schema) 30 public function up(Schema $schema)
31 { 31 {
32 $this->addSql('ALTER TABLE `'.$this->getTable('entry').'` ADD `uuid` LONGTEXT DEFAULT NULL'); 32 if ($this->connection->getDatabasePlatform()->getName() == 'postgresql') {
33 $this->addSql("INSERT INTO `".$this->getTable('craue_config_setting')."` (`name`, `value`, `section`) VALUES ('share_public', '1', 'entry')"); 33 $this->addSql('ALTER TABLE '.$this->getTable('entry').' ADD uuid UUID DEFAULT NULL');
34 } else {
35 $this->addSql('ALTER TABLE '.$this->getTable('entry').' ADD uuid LONGTEXT DEFAULT NULL');
36 }
37 $this->addSql("INSERT INTO ".$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_public', '1', 'entry')");
34 } 38 }
35 39
36 /** 40 /**
@@ -40,7 +44,7 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI
40 { 44 {
41 $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.'); 45 $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
42 46
43 $this->addSql('ALTER TABLE `'.$this->getTable('entry').'` DROP `uuid`'); 47 $this->addSql('ALTER TABLE '.$this->getTable('entry').' DROP uuid');
44 $this->addSql("DELETE FROM `".$this->getTable('craue_config_setting')."` WHERE `name` = 'share_public'"); 48 $this->addSql("DELETE FROM ".$this->getTable('craue_config_setting')." WHERE name = 'share_public'");
45 } 49 }
46} 50}
diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php
index a8d3bcf2..39423e2f 100644
--- a/app/DoctrineMigrations/Version20160812120952.php
+++ b/app/DoctrineMigrations/Version20160812120952.php
@@ -29,10 +29,17 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
29 */ 29 */
30 public function up(Schema $schema) 30 public function up(Schema $schema)
31 { 31 {
32 if ($this->connection->getDatabasePlatform()->getName() == 'sqlite') { 32 switch ($this->connection->getDatabasePlatform()->getName()) {
33 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext DEFAULT NULL'); 33 case 'sqlite':
34 } else { 34 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext DEFAULT NULL');
35 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext COLLATE \'utf8_unicode_ci\' DEFAULT NULL'); 35 break;
36
37 case 'mysql':
38 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext COLLATE \'utf8_unicode_ci\' DEFAULT NULL');
39 break;
40
41 case 'postgresql':
42 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name text DEFAULT NULL');
36 } 43 }
37 } 44 }
38 45
diff --git a/app/DoctrineMigrations/Version20160911214952.php b/app/DoctrineMigrations/Version20160911214952.php
index 35809cec..3f988ccf 100644
--- a/app/DoctrineMigrations/Version20160911214952.php
+++ b/app/DoctrineMigrations/Version20160911214952.php
@@ -29,8 +29,8 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI
29 */ 29 */
30 public function up(Schema $schema) 30 public function up(Schema $schema)
31 { 31 {
32 $this->addSql('INSERT INTO `'.$this->getTable('craue_config_setting').'` (`name`, `value`, `section`) VALUES (\'import_with_redis\', \'0\', \'import\')'); 32 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting').' (name, value, section) VALUES (\'import_with_redis\', \'0\', \'import\')');
33 $this->addSql('INSERT INTO `'.$this->getTable('craue_config_setting').'` (`name`, `value`, `section`) VALUES (\'import_with_rabbitmq\', \'0\', \'import\')'); 33 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting').' (name, value, section) VALUES (\'import_with_rabbitmq\', \'0\', \'import\')');
34 } 34 }
35 35
36 /** 36 /**
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php
index 202901e6..fc4e700a 100644
--- a/app/DoctrineMigrations/Version20160916201049.php
+++ b/app/DoctrineMigrations/Version20160916201049.php
@@ -30,7 +30,7 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI
30 public function up(Schema $schema) 30 public function up(Schema $schema)
31 { 31 {
32 $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL'); 32 $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL');
33 $this->addSql("DELETE FROM `".$this->getTable('craue_config_setting')."` WHERE `name` = 'pocket_consumer_key';"); 33 $this->addSql("DELETE FROM ".$this->getTable('craue_config_setting')." WHERE name = 'pocket_consumer_key';");
34 } 34 }
35 35
36 /** 36 /**
@@ -40,7 +40,7 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI
40 { 40 {
41 $this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); 41 $this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
42 42
43 $this->addSql('ALTER TABLE `'.$this->getTable('config').'` DROP pocket_consumer_key'); 43 $this->addSql('ALTER TABLE '.$this->getTable('config').' DROP pocket_consumer_key');
44 $this->addSql("INSERT INTO `".$this->getTable('craue_config_setting')."` (`name`, `value`, `section`) VALUES ('pocket_consumer_key', NULL, 'import')"); 44 $this->addSql("INSERT INTO ".$this->getTable('craue_config_setting')." (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')");
45 } 45 }
46} 46}
diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php
new file mode 100644
index 00000000..237db932
--- /dev/null
+++ b/app/DoctrineMigrations/Version20161001072726.php
@@ -0,0 +1,63 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10class Version20161001072726 extends AbstractMigration implements ContainerAwareInterface
11{
12 /**
13 * @var ContainerInterface
14 */
15 private $container;
16
17 public function setContainer(ContainerInterface $container = null)
18 {
19 $this->container = $container;
20 }
21
22 private function getTable($tableName)
23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName;
25 }
26
27 /**
28 * @param Schema $schema
29 */
30 public function up(Schema $schema)
31 {
32 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
33
34 // remove all FK from entry_tag
35 $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()."'");
36 $query->execute();
37
38 foreach ($query->fetchAll() as $fk) {
39 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']);
40 }
41
42 $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');
43 $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');
44
45 // remove entry FK from annotation
46 $query = $this->connection->query("SELECT CONSTRAINT_NAME FROM information_schema.key_column_usage WHERE TABLE_NAME = '".$this->getTable('annotation')."' AND CONSTRAINT_NAME LIKE 'FK_%' and COLUMN_NAME = 'entry_id' AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'");
47 $query->execute();
48
49 foreach ($query->fetchAll() as $fk) {
50 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']);
51 }
52
53 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE');
54 }
55
56 /**
57 * @param Schema $schema
58 */
59 public function down(Schema $schema)
60 {
61 throw new SkipMigrationException('Too complex ...');
62 }
63}
diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php
new file mode 100644
index 00000000..5cce55a5
--- /dev/null
+++ b/app/DoctrineMigrations/Version20161022134138.php
@@ -0,0 +1,77 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10class Version20161022134138 extends AbstractMigration implements ContainerAwareInterface
11{
12 /**
13 * @var ContainerInterface
14 */
15 private $container;
16
17 public function setContainer(ContainerInterface $container = null)
18 {
19 $this->container = $container;
20 }
21
22 private function getTable($tableName)
23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName;
25 }
26
27 /**
28 * @param Schema $schema
29 */
30 public function up(Schema $schema)
31 {
32 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL');
33
34 $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;');
35
36 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
37 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
38 $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
39 $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
40
41 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
42 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
43
44 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
45 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
46
47 $this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
48
49 $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
50 }
51
52 /**
53 * @param Schema $schema
54 */
55 public function down(Schema $schema)
56 {
57 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL');
58
59 $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;');
60
61 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
62 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
63 $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
64 $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
65
66 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
67 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
68
69 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
70 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
71
72 $this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
73
74 $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
75
76 }
77}
diff --git a/app/config/config.yml b/app/config/config.yml
index b4760073..9dbc9d7c 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -75,7 +75,7 @@ doctrine:
75 dbname: "%database_name%" 75 dbname: "%database_name%"
76 user: "%database_user%" 76 user: "%database_user%"
77 password: "%database_password%" 77 password: "%database_password%"
78 charset: UTF8 78 charset: "%database_charset%"
79 path: "%database_path%" 79 path: "%database_path%"
80 unix_socket: "%database_socket%" 80 unix_socket: "%database_socket%"
81 server_version: 5.6 81 server_version: 5.6
diff --git a/app/config/config_test.yml b/app/config/config_test.yml
index 3eab6fb2..f5e2c25e 100644
--- a/app/config/config_test.yml
+++ b/app/config/config_test.yml
@@ -28,7 +28,7 @@ doctrine:
28 dbname: "%test_database_name%" 28 dbname: "%test_database_name%"
29 user: "%test_database_user%" 29 user: "%test_database_user%"
30 password: "%test_database_password%" 30 password: "%test_database_password%"
31 charset: UTF8 31 charset: "%test_database_charset%"
32 path: "%test_database_path%" 32 path: "%test_database_path%"
33 orm: 33 orm:
34 metadata_cache_driver: 34 metadata_cache_driver:
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index ece4903a..7a22cb98 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -19,16 +19,18 @@ parameters:
19 database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" 19 database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
20 database_table_prefix: wallabag_ 20 database_table_prefix: wallabag_
21 database_socket: null 21 database_socket: null
22 # with MySQL, use "utf8mb4" if you got problem with content with emojis
23 database_charset: utf8
22 24
23 mailer_transport: smtp 25 mailer_transport: smtp
24 mailer_host: 127.0.0.1 26 mailer_host: 127.0.0.1
25 mailer_user: ~ 27 mailer_user: ~
26 mailer_password: ~ 28 mailer_password: ~
27 29
28 locale: en 30 locale: en
29 31
30 # A secret key that's used to generate certain security-related tokens 32 # A secret key that's used to generate certain security-related tokens
31 secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv 33 secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv
32 34
33 # two factor stuff 35 # two factor stuff
34 twofactor_auth: true 36 twofactor_auth: true
diff --git a/app/config/parameters_test.yml b/app/config/parameters_test.yml
index 2943b27a..5f2e25bb 100644
--- a/app/config/parameters_test.yml
+++ b/app/config/parameters_test.yml
@@ -6,3 +6,4 @@ parameters:
6 test_database_user: null 6 test_database_user: null
7 test_database_password: null 7 test_database_password: null
8 test_database_path: '%kernel.root_dir%/../data/db/wallabag_test.sqlite' 8 test_database_path: '%kernel.root_dir%/../data/db/wallabag_test.sqlite'
9 test_database_charset: utf8
diff --git a/app/config/tests/parameters_test.mysql.yml b/app/config/tests/parameters_test.mysql.yml
index d8512845..bca2d466 100644
--- a/app/config/tests/parameters_test.mysql.yml
+++ b/app/config/tests/parameters_test.mysql.yml
@@ -6,3 +6,4 @@ parameters:
6 test_database_user: root 6 test_database_user: root
7 test_database_password: ~ 7 test_database_password: ~
8 test_database_path: ~ 8 test_database_path: ~
9 test_database_charset: utf8mb4
diff --git a/app/config/tests/parameters_test.pgsql.yml b/app/config/tests/parameters_test.pgsql.yml
index 41383868..3e18d4a0 100644
--- a/app/config/tests/parameters_test.pgsql.yml
+++ b/app/config/tests/parameters_test.pgsql.yml
@@ -6,3 +6,4 @@ parameters:
6 test_database_user: travis 6 test_database_user: travis
7 test_database_password: ~ 7 test_database_password: ~
8 test_database_path: ~ 8 test_database_path: ~
9 test_database_charset: utf8
diff --git a/app/config/tests/parameters_test.sqlite.yml b/app/config/tests/parameters_test.sqlite.yml
index 1952e3a6..b8a5f41a 100644
--- a/app/config/tests/parameters_test.sqlite.yml
+++ b/app/config/tests/parameters_test.sqlite.yml
@@ -6,3 +6,4 @@ parameters:
6 test_database_user: ~ 6 test_database_user: ~
7 test_database_password: ~ 7 test_database_password: ~
8 test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite" 8 test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite"
9 test_database_charset: utf8