From 74b7c0985d3ff2b2011d0809c9b71e505e9aa947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 14 Dec 2016 09:47:07 +0100 Subject: Added index on entry.uuid Useful for entry sharing --- app/DoctrineMigrations/Version20161214094403.php | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 app/DoctrineMigrations/Version20161214094403.php (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20161214094403.php b/app/DoctrineMigrations/Version20161214094403.php new file mode 100644 index 00000000..fc9acb5a --- /dev/null +++ b/app/DoctrineMigrations/Version20161214094403.php @@ -0,0 +1,53 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix').$tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + $this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.'); + + $entryTable->addIndex(['uuid'], $this->indexName); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + $this->skipIf(false === $entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.'); + + $entryTable->dropIndex($this->indexName); + } +} -- cgit v1.2.3 From 89cd670abfc77ca268a538c9323a4026fec06fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 23 Dec 2016 09:49:22 +0100 Subject: Changed uuid type in database --- app/DoctrineMigrations/Version20160410190541.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php index 0cdec008..8761a9bb 100644 --- a/app/DoctrineMigrations/Version20160410190541.php +++ b/app/DoctrineMigrations/Version20160410190541.php @@ -33,8 +33,9 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI $this->skipIf($entryTable->hasColumn('uuid'), 'It seems that you already played this migration.'); - $entryTable->addColumn('uuid', 'guid', [ + $entryTable->addColumn('uuid', 'string', [ 'notnull' => false, + 'length' => 23, ]); $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_public', '1', 'entry')"); } -- cgit v1.2.3 From 7239082a5e290dada1d393f7a25acebb09ace2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 29 Dec 2016 10:09:44 +0100 Subject: Renamed uuid to uid --- app/DoctrineMigrations/Version20160410190541.php | 6 +++--- app/DoctrineMigrations/Version20161214094403.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app/DoctrineMigrations') diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php index 8761a9bb..f166a325 100644 --- a/app/DoctrineMigrations/Version20160410190541.php +++ b/app/DoctrineMigrations/Version20160410190541.php @@ -31,9 +31,9 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI { $entryTable = $schema->getTable($this->getTable('entry')); - $this->skipIf($entryTable->hasColumn('uuid'), 'It seems that you already played this migration.'); + $this->skipIf($entryTable->hasColumn('uid'), 'It seems that you already played this migration.'); - $entryTable->addColumn('uuid', 'string', [ + $entryTable->addColumn('uid', 'string', [ 'notnull' => false, 'length' => 23, ]); @@ -46,7 +46,7 @@ class Version20160410190541 extends AbstractMigration implements ContainerAwareI public function down(Schema $schema) { $entryTable = $schema->getTable($this->getTable('entry')); - $entryTable->dropColumn('uuid'); + $entryTable->dropColumn('uid'); $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_public'"); } diff --git a/app/DoctrineMigrations/Version20161214094403.php b/app/DoctrineMigrations/Version20161214094403.php index fc9acb5a..5948b5fa 100644 --- a/app/DoctrineMigrations/Version20161214094403.php +++ b/app/DoctrineMigrations/Version20161214094403.php @@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Added index on wallabag_entry.uuid + * Added index on wallabag_entry.uid */ class Version20161214094403 extends AbstractMigration implements ContainerAwareInterface { @@ -17,7 +17,7 @@ class Version20161214094403 extends AbstractMigration implements ContainerAwareI */ private $container; - private $indexName = 'IDX_entry_uiid'; + private $indexName = 'IDX_entry_uid'; public function setContainer(ContainerInterface $container = null) { @@ -37,7 +37,7 @@ class Version20161214094403 extends AbstractMigration implements ContainerAwareI $entryTable = $schema->getTable($this->getTable('entry')); $this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.'); - $entryTable->addIndex(['uuid'], $this->indexName); + $entryTable->addIndex(['uid'], $this->indexName); } /** -- cgit v1.2.3