From a44ce74d9b700a1315bedba5879af5342a2a9d3e Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Mon, 6 Nov 2017 04:43:23 +0300 Subject: [PATCH] Fix #39. Duplicated index 'subscriptions.subscription_unique' removed. --- .../Version20171106013937.php | 34 +++++++++++++++++++ .../PointToolsBundle/Entity/Subscription.php | 4 +-- 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 app/DoctrineMigrations/Version20171106013937.php diff --git a/app/DoctrineMigrations/Version20171106013937.php b/app/DoctrineMigrations/Version20171106013937.php new file mode 100644 index 0000000..7100436 --- /dev/null +++ b/app/DoctrineMigrations/Version20171106013937.php @@ -0,0 +1,34 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('DROP INDEX subscriptions.subscription_unique'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('CREATE UNIQUE INDEX subscription_unique ON subscriptions.subscriptions (author_id, subscriber_id)'); + } +} diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php index 43f1d93..e42f878 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php @@ -5,9 +5,7 @@ namespace Skobkin\Bundle\PointToolsBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** - * @ORM\Table(name="subscriptions", schema="subscriptions", uniqueConstraints={ - * @ORM\UniqueConstraint(name="subscription_unique", columns={"author_id", "subscriber_id"})} - * ) + * @ORM\Table(name="subscriptions", schema="subscriptions") * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionRepository", readOnly=true) */ class Subscription