Fix #39. Duplicated index 'subscriptions.subscription_unique' removed.
This commit is contained in:
parent
34bf869cea
commit
a44ce74d9b
34
app/DoctrineMigrations/Version20171106013937.php
Normal file
34
app/DoctrineMigrations/Version20171106013937.php
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Application\Migrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* subscription_unique index was removed because it was duplicating PK of the table.
|
||||||
|
*/
|
||||||
|
class Version20171106013937 extends AbstractMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Schema $schema
|
||||||
|
*/
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
// this up() 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('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)');
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,9 +5,7 @@ namespace Skobkin\Bundle\PointToolsBundle\Entity;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Table(name="subscriptions", schema="subscriptions", uniqueConstraints={
|
* @ORM\Table(name="subscriptions", schema="subscriptions")
|
||||||
* @ORM\UniqueConstraint(name="subscription_unique", columns={"author_id", "subscriber_id"})}
|
|
||||||
* )
|
|
||||||
* @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionRepository", readOnly=true)
|
* @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionRepository", readOnly=true)
|
||||||
*/
|
*/
|
||||||
class Subscription
|
class Subscription
|
||||||
|
|
Loading…
Reference in a new issue