aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations
diff options
context:
space:
mode:
Diffstat (limited to 'app/DoctrineMigrations')
-rw-r--r--app/DoctrineMigrations/Version20160410190541.php2
-rw-r--r--app/DoctrineMigrations/Version20160812120952.php2
-rw-r--r--app/DoctrineMigrations/Version20160911214952.php2
-rw-r--r--app/DoctrineMigrations/Version20160916201049.php2
-rw-r--r--app/DoctrineMigrations/Version20161001072726.php2
-rw-r--r--app/DoctrineMigrations/Version20161022134138.php2
-rw-r--r--app/DoctrineMigrations/Version20161024212538.php2
-rw-r--r--app/DoctrineMigrations/Version20161031132655.php2
-rw-r--r--app/DoctrineMigrations/Version20161104073720.php2
-rw-r--r--app/DoctrineMigrations/Version20161106113822.php2
-rw-r--r--app/DoctrineMigrations/Version20161117071626.php2
-rw-r--r--app/DoctrineMigrations/Version20161214094402.php2
-rw-r--r--app/DoctrineMigrations/Version20161214094403.php2
-rw-r--r--app/DoctrineMigrations/Version20170127093841.php2
-rw-r--r--app/DoctrineMigrations/Version20170327194233.php54
-rw-r--r--app/DoctrineMigrations/Version20170405182620.php65
-rw-r--r--app/DoctrineMigrations/Version20170407200919.php51
-rw-r--r--app/DoctrineMigrations/Version20170420134133.php52
-rw-r--r--app/DoctrineMigrations/Version20170510082609.php60
-rw-r--r--app/DoctrineMigrations/Version20170511115400.php55
-rw-r--r--app/DoctrineMigrations/Version20170511211659.php100
-rw-r--r--app/DoctrineMigrations/Version20170602075214.php52
-rw-r--r--app/DoctrineMigrations/Version20170606155640.php53
23 files changed, 556 insertions, 14 deletions
diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php
index 6294d842..5e5cae35 100644
--- a/app/DoctrineMigrations/Version20160410190541.php
+++ b/app/DoctrineMigrations/Version20160410190541.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added foreign keys for account resetting 11 * Added foreign keys for account resetting.
12 */ 12 */
13class Version20160410190541 extends AbstractMigration implements ContainerAwareInterface 13class Version20160410190541 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php
index bd6e8d63..13272267 100644
--- a/app/DoctrineMigrations/Version20160812120952.php
+++ b/app/DoctrineMigrations/Version20160812120952.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added name field on wallabag_oauth2_clients 11 * Added name field on wallabag_oauth2_clients.
12 */ 12 */
13class Version20160812120952 extends AbstractMigration implements ContainerAwareInterface 13class Version20160812120952 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20160911214952.php b/app/DoctrineMigrations/Version20160911214952.php
index edef81ed..4eae46e7 100644
--- a/app/DoctrineMigrations/Version20160911214952.php
+++ b/app/DoctrineMigrations/Version20160911214952.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added settings for RabbitMQ and Redis imports 11 * Added settings for RabbitMQ and Redis imports.
12 */ 12 */
13class Version20160911214952 extends AbstractMigration implements ContainerAwareInterface 13class Version20160911214952 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php
index 9f8e77e7..ff34c894 100644
--- a/app/DoctrineMigrations/Version20160916201049.php
+++ b/app/DoctrineMigrations/Version20160916201049.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added pocket_consumer_key field on wallabag_config 11 * Added pocket_consumer_key field on wallabag_config.
12 */ 12 */
13class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface 13class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php
index f247c236..ad761541 100644
--- a/app/DoctrineMigrations/Version20161001072726.php
+++ b/app/DoctrineMigrations/Version20161001072726.php
@@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
9use Doctrine\DBAL\Migrations\SkipMigrationException; 9use 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.
13 */ 13 */
14class Version20161001072726 extends AbstractMigration implements ContainerAwareInterface 14class Version20161001072726 extends AbstractMigration implements ContainerAwareInterface
15{ 15{
diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php
index c71166a0..39949e7d 100644
--- a/app/DoctrineMigrations/Version20161022134138.php
+++ b/app/DoctrineMigrations/Version20161022134138.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Converted database to utf8mb4 encoding (for MySQL only) 11 * Converted database to utf8mb4 encoding (for MySQL only).
12 */ 12 */
13class Version20161022134138 extends AbstractMigration implements ContainerAwareInterface 13class Version20161022134138 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php
index ecb872d1..b2f6aaf8 100644
--- a/app/DoctrineMigrations/Version20161024212538.php
+++ b/app/DoctrineMigrations/Version20161024212538.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added user_id column on oauth2_clients to prevent users to delete API clients from other users 11 * Added user_id column on oauth2_clients to prevent users to delete API clients from other users.
12 */ 12 */
13class Version20161024212538 extends AbstractMigration implements ContainerAwareInterface 13class Version20161024212538 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161031132655.php b/app/DoctrineMigrations/Version20161031132655.php
index 83b97ca9..ef846412 100644
--- a/app/DoctrineMigrations/Version20161031132655.php
+++ b/app/DoctrineMigrations/Version20161031132655.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added the internal setting to enable/disable downloading pictures 11 * Added the internal setting to enable/disable downloading pictures.
12 */ 12 */
13class Version20161031132655 extends AbstractMigration implements ContainerAwareInterface 13class Version20161031132655 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161104073720.php b/app/DoctrineMigrations/Version20161104073720.php
index fb8f5fa1..0e05f02e 100644
--- a/app/DoctrineMigrations/Version20161104073720.php
+++ b/app/DoctrineMigrations/Version20161104073720.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added created_at index on entry table 11 * Added created_at index on entry table.
12 */ 12 */
13class Version20161104073720 extends AbstractMigration implements ContainerAwareInterface 13class Version20161104073720 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php
index de3702a4..facc14f4 100644
--- a/app/DoctrineMigrations/Version20161106113822.php
+++ b/app/DoctrineMigrations/Version20161106113822.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added action_mark_as_read field on config table 11 * Added action_mark_as_read field on config table.
12 */ 12 */
13class Version20161106113822 extends AbstractMigration implements ContainerAwareInterface 13class Version20161106113822 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161117071626.php b/app/DoctrineMigrations/Version20161117071626.php
index 8daa2142..e779eacf 100644
--- a/app/DoctrineMigrations/Version20161117071626.php
+++ b/app/DoctrineMigrations/Version20161117071626.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added the internal setting to share articles to unmark.it 11 * Added the internal setting to share articles to unmark.it.
12 */ 12 */
13class Version20161117071626 extends AbstractMigration implements ContainerAwareInterface 13class Version20161117071626 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161214094402.php b/app/DoctrineMigrations/Version20161214094402.php
index db125f76..8ca32b09 100644
--- a/app/DoctrineMigrations/Version20161214094402.php
+++ b/app/DoctrineMigrations/Version20161214094402.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Renamed uuid to uid in entry table 11 * Renamed uuid to uid in entry table.
12 */ 12 */
13class Version20161214094402 extends AbstractMigration implements ContainerAwareInterface 13class Version20161214094402 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20161214094403.php b/app/DoctrineMigrations/Version20161214094403.php
index 5948b5fa..c7326f95 100644
--- a/app/DoctrineMigrations/Version20161214094403.php
+++ b/app/DoctrineMigrations/Version20161214094403.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added index on wallabag_entry.uid 11 * Added index on wallabag_entry.uid.
12 */ 12 */
13class Version20161214094403 extends AbstractMigration implements ContainerAwareInterface 13class Version20161214094403 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20170127093841.php b/app/DoctrineMigrations/Version20170127093841.php
index 20c79479..5bfd9670 100644
--- a/app/DoctrineMigrations/Version20170127093841.php
+++ b/app/DoctrineMigrations/Version20170127093841.php
@@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10/** 10/**
11 * Added indexes on wallabag_entry.is_starred and wallabag_entry.is_archived 11 * Added indexes on wallabag_entry.is_starred and wallabag_entry.is_archived.
12 */ 12 */
13class Version20170127093841 extends AbstractMigration implements ContainerAwareInterface 13class Version20170127093841 extends AbstractMigration implements ContainerAwareInterface
14{ 14{
diff --git a/app/DoctrineMigrations/Version20170327194233.php b/app/DoctrineMigrations/Version20170327194233.php
new file mode 100644
index 00000000..e1466b2f
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170327194233.php
@@ -0,0 +1,54 @@
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
10/**
11 * Add the share_scuttle internal setting.
12 */
13class Version20170327194233 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix').$tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $scuttle = $this->container
36 ->get('doctrine.orm.default_entity_manager')
37 ->getConnection()
38 ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_scuttle'");
39
40 $this->skipIf(false !== $scuttle, 'It seems that you already played this migration.');
41
42 $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')");
44 }
45
46 /**
47 * @param Schema $schema
48 */
49 public function down(Schema $schema)
50 {
51 $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';");
53 }
54}
diff --git a/app/DoctrineMigrations/Version20170405182620.php b/app/DoctrineMigrations/Version20170405182620.php
new file mode 100644
index 00000000..3ef9633f
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170405182620.php
@@ -0,0 +1,65 @@
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
10/**
11 * Add published_at and published_by in `entry` table.
12 */
13class Version20170405182620 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix').$tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $entryTable = $schema->getTable($this->getTable('entry'));
36
37 $this->skipIf($entryTable->hasColumn('published_at'), 'It seems that you already played this migration.');
38
39 $entryTable->addColumn('published_at', 'datetime', [
40 'notnull' => false,
41 ]);
42
43 $this->skipIf($entryTable->hasColumn('published_by'), 'It seems that you already played this migration.');
44
45 $entryTable->addColumn('published_by', 'text', [
46 'notnull' => false,
47 ]);
48 }
49
50 /**
51 * @param Schema $schema
52 */
53 public function down(Schema $schema)
54 {
55 $entryTable = $schema->getTable($this->getTable('entry'));
56
57 $this->skipIf(!$entryTable->hasColumn('published_at'), 'It seems that you already played this migration.');
58
59 $entryTable->dropColumn('published_at');
60
61 $this->skipIf(!$entryTable->hasColumn('published_by'), 'It seems that you already played this migration.');
62
63 $entryTable->dropColumn('published_by');
64 }
65}
diff --git a/app/DoctrineMigrations/Version20170407200919.php b/app/DoctrineMigrations/Version20170407200919.php
new file mode 100644
index 00000000..4b9d475a
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170407200919.php
@@ -0,0 +1,51 @@
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
10/**
11 * Remove isPublic in Entry Table.
12 */
13class Version20170407200919 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix').$tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $entryTable = $schema->getTable($this->getTable('entry'));
36 $this->skipIf(!$entryTable->hasColumn('is_public'), 'It seems that you already played this migration.');
37
38 $entryTable->dropColumn('is_public');
39 }
40
41 /**
42 * @param Schema $schema
43 */
44 public function down(Schema $schema)
45 {
46 $entryTable = $schema->getTable($this->getTable('entry'));
47 $this->skipIf($entryTable->hasColumn('is_public'), 'It seems that you already played this migration.');
48
49 $entryTable->addColumn('is_public', 'boolean', ['notnull' => false, 'default' => 0]);
50 }
51}
diff --git a/app/DoctrineMigrations/Version20170420134133.php b/app/DoctrineMigrations/Version20170420134133.php
new file mode 100644
index 00000000..b1ab7bcb
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170420134133.php
@@ -0,0 +1,52 @@
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
10/**
11 * Remove download_pictures in craue_config_setting.
12 */
13class Version20170420134133 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix').$tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures';");
36 }
37
38 /**
39 * @param Schema $schema
40 */
41 public function down(Schema $schema)
42 {
43 $downloadPictures = $this->container
44 ->get('doctrine.orm.default_entity_manager')
45 ->getConnection()
46 ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures'");
47
48 $this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.');
49
50 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_pictures', '1', 'entry')");
51 }
52}
diff --git a/app/DoctrineMigrations/Version20170510082609.php b/app/DoctrineMigrations/Version20170510082609.php
new file mode 100644
index 00000000..a99af2d2
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170510082609.php
@@ -0,0 +1,60 @@
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
10/**
11 * Changed length for username, username_canonical, email and email_canonical fields in wallabag_user table.
12 */
13class Version20170510082609 extends AbstractMigration implements ContainerAwareInterface
14{
15 private $fields = [
16 'username',
17 'username_canonical',
18 'email',
19 'email_canonical',
20 ];
21
22 /**
23 * @var ContainerInterface
24 */
25 private $container;
26
27 public function setContainer(ContainerInterface $container = null)
28 {
29 $this->container = $container;
30 }
31
32 private function getTable($tableName)
33 {
34 return $this->container->getParameter('database_table_prefix').$tableName;
35 }
36
37 /**
38 * @param Schema $schema
39 */
40 public function up(Schema $schema)
41 {
42 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL');
43
44 foreach ($this->fields as $field) {
45 $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(180) NOT NULL;');
46 }
47 }
48
49 /**
50 * @param Schema $schema
51 */
52 public function down(Schema $schema)
53 {
54 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL');
55
56 foreach ($this->fields as $field) {
57 $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE '.$field.' '.$field.' VARCHAR(255) NOT NULL;');
58 }
59 }
60}
diff --git a/app/DoctrineMigrations/Version20170511115400.php b/app/DoctrineMigrations/Version20170511115400.php
new file mode 100644
index 00000000..64ee9e0a
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170511115400.php
@@ -0,0 +1,55 @@
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
10/**
11 * Added `headers` field in entry table.
12 */
13class Version20170511115400 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix').$tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $entryTable = $schema->getTable($this->getTable('entry'));
36
37 $this->skipIf($entryTable->hasColumn('headers'), 'It seems that you already played this migration.');
38
39 $entryTable->addColumn('headers', 'text', [
40 'notnull' => false,
41 ]);
42 }
43
44 /**
45 * @param Schema $schema
46 */
47 public function down(Schema $schema)
48 {
49 $entryTable = $schema->getTable($this->getTable('entry'));
50
51 $this->skipIf(!$entryTable->hasColumn('headers'), 'It seems that you already played this migration.');
52
53 $entryTable->dropColumn('headers');
54 }
55}
diff --git a/app/DoctrineMigrations/Version20170511211659.php b/app/DoctrineMigrations/Version20170511211659.php
new file mode 100644
index 00000000..f2d5cf5e
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170511211659.php
@@ -0,0 +1,100 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Migrations\SkipMigrationException;
7use Doctrine\DBAL\Schema\Schema;
8use Symfony\Component\DependencyInjection\ContainerAwareInterface;
9use Symfony\Component\DependencyInjection\ContainerInterface;
10
11/**
12 * Increase the length of the "quote" column of "annotation" table
13 */
14class Version20170511211659 extends AbstractMigration implements ContainerAwareInterface
15{
16 /**
17 * @var ContainerInterface
18 */
19 private $container;
20
21 public function setContainer(ContainerInterface $container = null)
22 {
23 $this->container = $container;
24 }
25
26 private function getTable($tableName)
27 {
28 return $this->container->getParameter('database_table_prefix') . $tableName;
29 }
30
31 public function up(Schema $schema)
32 {
33 $tableName = $this->getTable('annotation');
34
35 switch ($this->connection->getDatabasePlatform()->getName()) {
36 case 'sqlite':
37 $this->addSql(<<<EOD
38CREATE TEMPORARY TABLE __temp__wallabag_annotation AS
39 SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
40 FROM ${tableName}
41EOD
42 );
43 $this->addSql('DROP TABLE ' . $tableName);
44 $this->addSql(<<<EOD
45CREATE TABLE ${tableName}
46(
47 id INTEGER PRIMARY KEY NOT NULL,
48 user_id INTEGER DEFAULT NULL,
49 entry_id INTEGER DEFAULT NULL,
50 text CLOB NOT NULL,
51 created_at DATETIME NOT NULL,
52 updated_at DATETIME NOT NULL,
53 quote CLOB NOT NULL,
54 ranges CLOB NOT NULL,
55 CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES wallabag_user (id),
56 CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES wallabag_entry (id) ON DELETE CASCADE
57);
58CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
59CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
60EOD
61 );
62
63 $this->addSql(<<<EOD
64INSERT INTO ${tableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges)
65SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
66FROM __temp__wallabag_annotation;
67EOD
68 );
69 $this->addSql('DROP TABLE __temp__wallabag_annotation');
70 break;
71
72 case 'mysql':
73 $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote TEXT NOT NULL');
74 break;
75
76 case 'postgresql':
77 $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE TEXT');
78 break;
79 }
80 }
81
82 public function down(Schema $schema)
83 {
84 $tableName = $this->getTable('annotation');
85
86 switch ($this->connection->getDatabasePlatform()->getName()) {
87 case 'sqlite':
88 throw new SkipMigrationException('Too complex ...');
89 break;
90
91 case 'mysql':
92 $this->addSql('ALTER TABLE '.$tableName.' MODIFY quote VARCHAR(255) NOT NULL');
93 break;
94
95 case 'postgresql':
96 $this->addSql('ALTER TABLE '.$tableName.' ALTER COLUMN quote TYPE VARCHAR(255)');
97 break;
98 }
99 }
100}
diff --git a/app/DoctrineMigrations/Version20170602075214.php b/app/DoctrineMigrations/Version20170602075214.php
new file mode 100644
index 00000000..451d16ba
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170602075214.php
@@ -0,0 +1,52 @@
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
10/**
11 * Add api_user_registration in craue_config_setting.
12 */
13class Version20170602075214 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix').$tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $apiUserRegistration = $this->container
36 ->get('doctrine.orm.default_entity_manager')
37 ->getConnection()
38 ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration'");
39
40 $this->skipIf(false !== $apiUserRegistration, 'It seems that you already played this migration.');
41
42 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('api_user_registration', '0', 'api')");
43 }
44
45 /**
46 * @param Schema $schema
47 */
48 public function down(Schema $schema)
49 {
50 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration';");
51 }
52}
diff --git a/app/DoctrineMigrations/Version20170606155640.php b/app/DoctrineMigrations/Version20170606155640.php
new file mode 100644
index 00000000..e9b50428
--- /dev/null
+++ b/app/DoctrineMigrations/Version20170606155640.php
@@ -0,0 +1,53 @@
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
10/**
11 * Remove wallabag_url from craue_config_setting.
12 * It has been moved into the parameters.yml
13 */
14class Version20170606155640 extends AbstractMigration implements ContainerAwareInterface
15{
16 /**
17 * @var ContainerInterface
18 */
19 private $container;
20
21 public function setContainer(ContainerInterface $container = null)
22 {
23 $this->container = $container;
24 }
25
26 private function getTable($tableName)
27 {
28 return $this->container->getParameter('database_table_prefix').$tableName;
29 }
30
31 /**
32 * @param Schema $schema
33 */
34 public function up(Schema $schema)
35 {
36 $apiUserRegistration = $this->container
37 ->get('doctrine.orm.default_entity_manager')
38 ->getConnection()
39 ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'");
40
41 $this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.');
42
43 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'");
44 }
45
46 /**
47 * @param Schema $schema
48 */
49 public function down(Schema $schema)
50 {
51 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')");
52 }
53}