From c7ee9b8ebbffecca9c3659c0b185226f9c7c3d16 Mon Sep 17 00:00:00 2001 From: Tchama Date: Fri, 1 Feb 2019 15:26:54 +0100 Subject: [PATCH] correction of moderator relation (user not person) --- Resources/config/doctrine/Event.orm.yml | 2 +- .../migrations/Version20190201143121.php | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Resources/migrations/Version20190201143121.php diff --git a/Resources/config/doctrine/Event.orm.yml b/Resources/config/doctrine/Event.orm.yml index 88bc2e9d1..7dabeb880 100644 --- a/Resources/config/doctrine/Event.orm.yml +++ b/Resources/config/doctrine/Event.orm.yml @@ -25,6 +25,6 @@ Chill\EventBundle\Entity\Event: circle: targetEntity: Chill\MainBundle\Entity\Scope moderator: - targetEntity: Chill\PersonBundle\Entity\Person + targetEntity: Chill\MainBundle\Entity\User lifecycleCallbacks: { } diff --git a/Resources/migrations/Version20190201143121.php b/Resources/migrations/Version20190201143121.php new file mode 100644 index 000000000..3687e4c2d --- /dev/null +++ b/Resources/migrations/Version20190201143121.php @@ -0,0 +1,31 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_event_event DROP CONSTRAINT FK_FA320FC8D0AFA354'); + $this->addSql('ALTER TABLE chill_event_event ADD CONSTRAINT FK_FA320FC8D0AFA354 FOREIGN KEY (moderator_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema) : void + { + // 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('ALTER TABLE chill_event_event DROP CONSTRAINT fk_fa320fc8d0afa354'); + $this->addSql('ALTER TABLE chill_event_event ADD CONSTRAINT fk_fa320fc8d0afa354 FOREIGN KEY (moderator_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + + } +}